5.0.2 • Published 7 months ago

@types/create-torrent v5.0.2

Weekly downloads
484
License
MIT
Repository
github
Last release
7 months ago

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

// Type definitions for create-torrent 5.0
// Project: https://github.com/webtorrent/create-torrent#readme
// Definitions by: Jesse Chan <https://github.com/jesec>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/// <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: Wed, 11 Aug 2021 22:01:28 GMT
  • Dependencies: @types/node
  • Global values: none

Credits

These definitions were written by Jesse Chan.

5.0.2

7 months ago

5.0.1

7 months ago

5.0.0

3 years ago

4.4.1

3 years ago

4.4.0

4 years ago