Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upmodernize lib/file.js and calculate downloaded correctly #1476
Conversation
This comment has been minimized.
This comment has been minimized.
request-info
bot
commented
Aug 18, 2018
This comment has been minimized.
This comment has been minimized.
welcome
bot
commented
Aug 18, 2018
|
LGTM |
| if (this._torrent.bitfield.get(index)) { | ||
| // verified data | ||
| downloaded += (index === this._endPiece) ? this._torrent.lastPieceLength : this._torrent.pieceLength | ||
| downloaded += index === this._endPiece ? this._torrent.lastPieceLength : this._torrent.pieceLength |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
jimmywarting
Aug 18, 2018
Author
Contributor
Hmm, standard didn't complain and it wasn't needed so i thought i could safely remove them
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I also notice Using the Sintel torrent as an example... It has 6 srt files and 1 small piece of the mp4 file in the first piece const file = client.get('08ada5a7a6183aae1e09d831df6748d566095a10').files[0]
console.log(file.done) // true
console.log(file.progress) // 39.58777239709443 <- incorrect b/c of download
console.log(file.downloaded) // 65399 <- this file fits inside one chunk and it's too big
console.log(file.length) // 1652I'm |
This comment has been minimized.
This comment has been minimized.
|
That should be a separate PR I think |
This comment has been minimized.
This comment has been minimized.
|
Correct, please separate into two PRs, let's keep this one about modernizing the code. |
This comment has been minimized.
This comment has been minimized.
|
ok, closing this then, new pr: #1478 |


jimmywarting commentedAug 18, 2018
•
edited
this fixes the calculation of
.files[i].downloaded