diff options
author | Gabriel Juchault <gabriel.juchault@gmail.com> | 2019-08-15 13:15:20 +0300 |
---|---|---|
committer | Gabriel Juchault <gabriel.juchault@gmail.com> | 2019-08-15 13:21:34 +0300 |
commit | f008b63081f8ba58eb89b1be7a6799b13709c5d1 (patch) | |
tree | ae321bb009038ef16747eefd655e293cbc7eff8f | |
parent | afdb8ededce392d13f677ce7a751582a3ef5b6a7 (diff) |
docs(api): add documentation for announce, maxWebConns, ready, paused, done, pieces, created, createdBy, comment, lenght, pieceLength and lastPieceLength
-rw-r--r-- | docs/api.md | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/docs/api.md b/docs/api.md index ca3a4f1..5634b15 100644 --- a/docs/api.md +++ b/docs/api.md @@ -221,11 +221,28 @@ Magnet URI of the torrent (string). `.torrent` file of the torrent (Blob URL). +## `torrent.announce[...]` + +Array of all tracker servers. Each announce is an URL (string). + ## `torrent.files[...]` Array of all files in the torrent. See documentation for `File` below to learn what methods/properties files have. +## `torrent.pieces[...]` + +Array of all pieces in the torrent. See documentation for `Piece` below to learn what +properties pieces have. Some pieces can be null. + +## `torrent.pieceLength` + +Length in bytes of every piece but the last one. + +## `torrent.lastPieceLength` + +Length in bytes of the last piece (<= of `torrent.pieceLength`). + ## `torrent.timeRemaining` Time remaining for download to complete (in milliseconds). @@ -262,10 +279,53 @@ Torrent "seed ratio" (uploaded / downloaded). Number of peers in the torrent swarm. +## `torrent.maxWebConns` + +Max number of simultaneous connections per web seed, as passed in the options. + ## `torrent.path` Torrent download location. +## `torrent.ready` + +True when the torrent is ready to be used (i.e. metadata is available and store is +ready). + +## `torrent.paused` + +True when the torrent has stopped connecting to new peers. Note that this does +not pause new incoming connections, nor does it pause the streams of existing +connections or their wires. + +## `torrent.done` + +True when all the torrent files have been downloaded. + +## `torrent.length` + +Sum of the files length (in bytes). + +## `torrent.pieceLength` + +Length in bytes of all the pieces but the last one. + +## `torrent.lastPieceLength` + +Length in bytes of the last piece (<= `torrent.pieceLength`) + +## `torrent.created` + +Date of creation of the torrent (as a [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) object). + +## `torrent.createdBy` + +Author of the torrent (string). + +## `torrent.comment` + +A comment optionnaly set by the author (string). + ## `torrent.destroy([callback])` Alias for `client.remove(torrent)`. If `callback` is provided, it will be called when @@ -637,3 +697,13 @@ file.getBlobURL(function (err, url) { document.body.appendChild(a) }) ``` + +# Piece API + +## `piece.length` + +Piece length (in bytes). *Example: 12345* + +## `piece.missing` + +Piece missing length (in bytes). *Example: 100* |