Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2016-05-02 16:26:38 +0300
committerFeross Aboukhadijeh <feross@feross.org>2016-05-02 16:26:38 +0300
commit4b008bde484c8c14285977775d6bb53c6a7f7ae8 (patch)
treefcdae84042bb961f2b724d2c676780f867c35c05 /docs
parent179bcd086995c5ea8379608dae73dff8768b4545 (diff)
doc style
Diffstat (limited to 'docs')
-rw-r--r--docs/api.md58
1 files changed, 24 insertions, 34 deletions
diff --git a/docs/api.md b/docs/api.md
index b745d94..6c47901 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -342,6 +342,21 @@ connections, nor does it pause the streams of existing connections or their wire
Resume connecting to new peers.
+## `torrent.on('infoHash', function () {})`
+
+Emitted when the info hash of the torrent has been determined.
+
+## `torrent.on('metadata', function () {})`
+
+Emitted when the metadata of the torrent has been determined. This includes the full
+contents of the .torrent file, including list of files, torrent length, piece hashes,
+piece length, etc.
+
+## `torrent.on('ready', function () {})`
+
+Emitted when the torrent is ready to be used (i.e. metadata is available and store is
+ready).
+
## `torrent.on('warning', function (err) {})`
Emitted when there is a warning. This is purely informational and it is not necessary to
@@ -367,33 +382,23 @@ torrent.on('done', function(){
})
```
-## `torrent.on('download', function (chunkSize) {})`
+## `torrent.on('download', function (bytes) {})`
-Emitted every time a new chunk of data arrives, it's useful for reporting the current torrent status, for instance:
+Emitted whenever data is downloaded. Useful for reporting the current torrent status, for
+instance:
```js
-torrent.on('download', function(chunkSize){
- console.log('chunk size: ' + chunkSize);
+torrent.on('download', function (bytes) {
+ console.log('just downloaded: ' + bytes)
console.log('total downloaded: ' + torrent.downloaded);
- console.log('download speed: ' + torrent.downloadSpeed);
- console.log('progress: ' + torrent.progress);
- console.log('======');
+ console.log('download speed: ' + torrent.downloadSpeed)
+ console.log('progress: ' + torrent.progress)
})
```
-## `torrent.on('upload', function (chunkSize) {})`
+## `torrent.on('upload', function (bytes) {})`
-Emitted every time a new chunk of data is sent, it's useful for reporting the current torrent status, for instance:
-
-```js
-torrent.on('uploaded', function(chunkSize){
- console.log('chunk size: ' + chunkSize);
- console.log('total uploaded: ' + torrent.uploaded);
- console.log('upload speed: ' + torrent.uploadSpeed);
- console.log('progress: ' + torrent.progress);
- console.log('======');
-})
-```
+Emitted whenever data is uploaded. Useful for reporting the current torrent status.
## `torrent.on('wire', function (wire) {})`
@@ -417,21 +422,6 @@ See the `bittorrent-protocol`
[extension api docs](https://github.com/feross/bittorrent-protocol#extension-api) for more
information on how to define a protocol extension.
-## `torrent.on('infoHash', function () {})`
-
-Emitted when the info hash of the torrent has been determined.
-
-## `torrent.on('metadata', function () {})`
-
-Emitted when the metadata of the torrent has been determined. This includes the full
-contents of the .torrent file, including list of files, torrent length, piece hashes,
-piece length, etc.
-
-## `torrent.on('ready', function () {})`
-
-Emitted when the torrent is ready to be used (i.e. metadata is available and store is
-ready).
-
# File API
## `file.name`