diff options
author | Diego RodrÃguez Baquero <diegorbaquero@gmail.com> | 2017-09-29 00:45:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-29 00:45:07 +0300 |
commit | a39cc30c94a733f8510773617ae4b84fb230ff1d (patch) | |
tree | 45f9c7c930c80d8cf2fdf1c78874e167f30fd017 | |
parent | acef48f1d97a80902024468616dcfc558b1faddd (diff) | |
parent | 54ce21637fa054271e025f2c4b4ead558bec95ad (diff) |
Merge pull request #1194 from alxhotel/master
Fix file.downloaded for last piece
-rw-r--r-- | lib/file.js | 2 |
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] |