From a2056681fd31659a0ddcb097e1df5f6c4105c905 Mon Sep 17 00:00:00 2001 From: Lunik Date: Fri, 15 Apr 2016 22:13:48 +0200 Subject: [PATCH] Api for upload trigger on torrent --- docs/api.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/api.md b/docs/api.md index 124899d8..dd8ec837 100644 --- a/docs/api.md +++ b/docs/api.md @@ -378,6 +378,20 @@ torrent.on('download', function(chunkSize){ }) ``` +## `torrent.on('upload', function (chunkSize) {})` + +Emitted every time a new chunk of data is sent, it's useful for reporting the current torrent status, for instance: + +```js +torrent.on('upload', 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('======'); +}) +``` + ## `torrent.on('wire', function (wire) {})` Emitted whenever a new peer is connected for this torrent. `wire` is an instance of