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/lib
diff options
context:
space:
mode:
authorAlex <alxmorais8@msn.com>2017-09-25 12:22:52 +0300
committerAlex <alxmorais8@msn.com>2017-09-25 12:22:52 +0300
commit54ce21637fa054271e025f2c4b4ead558bec95ad (patch)
treeae25eb44e2a38ec5604545c9a5a3d5994f66461e /lib
parent598d944c07b190e7e7e976b1b44d857cf0b2c14d (diff)
Fix file.downloaded for last piece
Diffstat (limited to 'lib')
-rw-r--r--lib/file.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/file.js b/lib/file.js
index d912faa..eb2fc21 100644
--- a/lib/file.js
+++ b/lib/file.js
@@ -45,7 +45,7 @@ Object.defineProperty(File.prototype, 'downloaded', {
for (var index = this._startPiece; index <= this._endPiece; ++index) {
if (this._torrent.bitfield.get(index)) {
// verified data
- downloaded += this._torrent.pieceLength
+ downloaded += (index === this._endPiece) ? this._torrent.lastPieceLength : this._torrent.pieceLength
} else {
// "in progress" data
var piece = this._torrent.pieces[index]