Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(api): add documentation for some properties #1708

Merged
merged 2 commits into from Aug 15, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Next

docs(api): add documentation for announce, maxWebConns, ready, paused…

…, done, pieces, created, createdBy, comment, lenght, pieceLength and lastPieceLength
  • Loading branch information
gjuchault committed Aug 15, 2019
commit f008b63081f8ba58eb89b1be7a6799b13709c5d1
@@ -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`

This comment has been minimized.

Copy link
@feross

feross Aug 15, 2019

Member

This is duplicated


Length in bytes of all the pieces but the last one.

## `torrent.lastPieceLength`

This comment has been minimized.

Copy link
@feross

feross Aug 15, 2019

Member

So is this


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*
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.