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
diff options
context:
space:
mode:
authorDiego Rodríguez Baquero <diegorbaquero@gmail.com>2017-09-29 00:45:07 +0300
committerGitHub <noreply@github.com>2017-09-29 00:45:07 +0300
commita39cc30c94a733f8510773617ae4b84fb230ff1d (patch)
tree45f9c7c930c80d8cf2fdf1c78874e167f30fd017
parentacef48f1d97a80902024468616dcfc558b1faddd (diff)
parent54ce21637fa054271e025f2c4b4ead558bec95ad (diff)
Merge pull request #1194 from alxhotel/master
Fix file.downloaded for last piece
-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]