Methods
torrent.select(start, end, [priority], [notify])
Selects a range of pieces to prioritize.
Start piece index (inclusive)
End piece index (inclusive)
Priority level (higher = more important)
Callback called when selection is updated
torrent.deselect(start, end)
Deprioritizes a range of previously selected pieces.
Start piece index
End piece index
torrent.critical(start, end)
Marks a range of pieces as critical priority to be downloaded ASAP.
Start piece index
End piece index
torrent.addPeer(peer)
Manually add a peer to the torrent swarm.
Peer address string (‘ip:port’) or SimplePeer instance for WebRTC
Returns true if peer was added, false if blocked
torrent.addWebSeed(urlOrConn)
Add a web seed to the torrent swarm.
Web seed URL or custom connection object
torrent.removePeer(peer)
Remove a peer from the torrent swarm.
Peer address, peer ID (hex string), or SimplePeer instance
torrent.pause()
Temporarily stop connecting to new peers.
This does not pause existing connections or their data streams.
torrent.resume()
Resume connecting to new peers.
torrent.rescanFiles([callback])
Verify the hashes of all pieces in the store and update the bitfield.
Called when scan is complete
torrent.destroy([opts], [callback])
Remove the torrent from its client.
Called when torrent is fully destroyed
Properties
torrent.name
Name of the torrent
torrent.infoHash
Info hash of the torrent (hex string)
torrent.magnetURI
Magnet URI of the torrent
torrent.torrentFile
.torrent file of the torrent
torrent.torrentFileBlob
.torrent file as a Blob (useful for creating Blob URLs)
torrent.files
torrent.pieces
Array of all pieces. Verified pieces are null.
torrent.announce
Array of all tracker server URLs
torrent.length
Sum of the file lengths (in bytes)
torrent.pieceLength
Length in bytes of every piece except the last one
torrent.lastPieceLength
Length in bytes of the last piece
torrent.path
Torrent download location
torrent.ready
True when torrent is ready to be used (metadata is available and store is ready)
torrent.paused
True when torrent has stopped connecting to new peers
torrent.done
True when all torrent files have been downloaded
torrent.progress
Torrent download progress, from 0 to 1
torrent.downloadSpeed
Torrent download speed, in bytes/sec
torrent.uploadSpeed
Torrent upload speed, in bytes/sec
torrent.downloaded
Total verified bytes received from peers
torrent.uploaded
Total bytes uploaded to peers
torrent.received
Total bytes received from peers (including invalid data)
torrent.ratio
Torrent seed ratio (uploaded / downloaded)
torrent.timeRemaining
Time remaining for download to complete (in milliseconds). Returns
Infinity if download speed is 0.torrent.numPeers
Number of peers in the torrent swarm
torrent.maxWebConns
Max number of simultaneous connections per web seed
torrent.created
Date of creation of the torrent
torrent.createdBy
Author of the torrent
torrent.comment
Comment optionally set by the author