# @types/create-torrent

> TypeScript definitions for create-torrent

Latest version **6.1.1** (published 2026-01-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/create-torrent
pnpm add @types/create-torrent
yarn add @types/create-torrent
bun add @types/create-torrent
```

## Health

**Score 70/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 6.1.1 |
| Published | 2026-01-13 |
| First published | 2020-10-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 1 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51482 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/create-torrent
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/create-torrent
- npm.io page: https://npm.io/package/@types/create-torrent

## Dependencies (1)

- [@types/node](https://npm.io/package/@types/node.md) *

## Recent versions

- 6.1.1 (latest) — 2026-01-13
- 5.0.2 (ts5.1) — 2023-11-07
- 5.0.0 (ts4.2) — 2021-08-11
- 4.4.0 (ts3.4) — 2020-10-12
- 6.1.0 — 2025-12-21
- 6.0.0 — 2024-07-05
- 5.0.1 — 2023-10-18
- 4.4.1 — 2021-07-08

## README

# Installation
> `npm install --save @types/create-torrent`

# Summary
This package contains type definitions for create-torrent (https://github.com/webtorrent/create-torrent#readme).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/create-torrent.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/create-torrent/index.d.ts)
````ts
/// <reference types="node" />
import type { Readable as ReadableStream } from "node:stream";

export type CreateTorrentCallback = (err: Error | null, torrent: Uint8Array) => void;

export interface CreateTorrentOptions {
    // name of the torrent (default = basename of `path`, or 1st file's name)
    name?: string | undefined;
    // free-form textual comments of the author
    comment?: string | undefined;
    // name and version of program used to create torrent
    createdBy?: string | undefined;
    // creation time in UNIX epoch format (default = now)
    creationDate?: number | Date | undefined;
    // is this a private .torrent? (default = false)
    private?: boolean | undefined;
    // force a custom piece length (number of bytes)
    pieceLength?: number | undefined;
    maxPieceLength?: number;
    // custom trackers (array of arrays of strings) (see [bep12](http://www.bittorrent.org/beps/bep_0012.html))
    announceList?: string[][] | undefined;
    // web seed urls (see [bep19](http://www.bittorrent.org/beps/bep_0019.html))
    urlList?: string[] | undefined;
    // add non-standard info dict entries, e.g. info.source, a convention for cross-seeding
    info?: Record<string, unknown>;
    // called with the number of bytes hashed and estimated total size after every piece
    onProgress?: (hashedLength: number, estimatedTorrentLength: number) => void;
}

export type TorrentInput =
    | string
    | File
    | FileList
    | Buffer
    | ReadableStream
    | string[]
    | File[]
    | Buffer[]
    | ReadableStream[];

declare function createTorrent(input: TorrentInput, opts: CreateTorrentOptions, cb: CreateTorrentCallback): void;
declare function createTorrent(input: TorrentInput, cb: CreateTorrentCallback): void;

declare const announceList: string[][];
declare function isJunkPath(path: string): boolean;

export default createTorrent;
export { announceList, isJunkPath };

````

### Additional Details
 * Last updated: Tue, 13 Jan 2026 03:05:28 GMT
 * Dependencies: [@types/node](https://npmjs.com/package/@types/node)

# Credits
These definitions were written by [Jesse Chan](https://github.com/jesec).

---
_Source: https://npm.io/package/@types/create-torrent · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
