UNPKG

@types/create-torrent

Version:
75 lines (65 loc) 2.53 kB
# 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" /> 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 | undefined; // is this a private .torrent? (default = false) private?: boolean | undefined; // force a custom piece length (number of bytes) pieceLength?: number | undefined; // 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, string> | undefined; // called with the number of bytes hashed and estimated total size after every piece onProgress?(hashedLength: number, estimatedTorrentLength: number): void; } declare function createTorrent( input: | string | string[] | File | File[] | FileList | Buffer | Buffer[] | NodeJS.ReadableStream | NodeJS.ReadableStream[], cb: (err: Error | null, torrent: Buffer) => any, ): void; declare function createTorrent( input: | string | string[] | File | File[] | FileList | Buffer | Buffer[] | NodeJS.ReadableStream | NodeJS.ReadableStream[], opts: CreateTorrentOptions, cb: (err: Error | null, torrent: Buffer) => any, ): void; export = createTorrent; ```` ### Additional Details * Last updated: Mon, 06 Nov 2023 22:41:05 GMT * Dependencies: [@types/node](https://npmjs.com/package/@types/node) # Credits These definitions were written by [Jesse Chan](https://github.com/jesec).