Hierarchy

  • FileTransfer

Constructors

Properties

torrentOpts: TorrentOptions
torrents: Record<string, Torrent> = {}
webTorrentClient: Instance

Methods

  • General-purpose cleanup method for when this FileTransfer instance is no longer needed.

    Returns void

  • Downloads and decrypts the files associated with magnetURI. For the download operation to succeed, the peer offering the file must maintain their offer until the downloading peer has finished downloading the data.

    Returns

    An array of downloaded files.

    Parameters

    • magnetURI: string

      A string that was returned by offer.

    • password: string

      The password to decrypt the files with. Must be the same as the password parameter that was provided to the offer call that produced magnetURI.

    • downloadOpts: DownloadOpts = {}

    Returns Promise<TorrentFile[]>

  • Parameters

    • file: TorrentFile
    • password: string

    Returns Promise<ReadableStream<any>>

  • Whether or not an offer associated with magnetURI is currently being made.

    Parameters

    • magnetURI: string

    Returns boolean

  • Makes a list of files available to others to download.

    Returns

    The torrent magnet URI that peers can use to download the offered file with download.

    Parameters

    • files: FileList | File[]

      The Files to offer to a peer.

    • password: string

      The encryption key for the files.

    • offerOpts: OfferOpts = {}

    Returns Promise<string>

  • Rescinds a file offer that was made by offer.

    Parameters

    • magnetURI: string

    Returns void

  • Rescinds all file offers.

    Returns void

  • Parameters

    • files: TorrentFile[]

    Returns Promise<void>

Generated using TypeDoc