Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calculate file downloaded correctly #1479

Merged
merged 3 commits into from Aug 24, 2018

Conversation

@jimmywarting
Copy link
Contributor

jimmywarting commented Aug 20, 2018

I notice file.download is calculated wrong.

Using the Sintel torrent as an example...
https://instant.io/#08ada5a7a6183aae1e09d831df6748d566095a10
(this can be tested in the console)

It has 6 srt files and 1 small piece of the mp4 file in the first piece
after the first piece is downloaded you can see that the first files are complete but the progress and downloaded are incorrect

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) // 1652
@DiegoRBaquero

This comment has been minimized.

Copy link
Member

DiegoRBaquero commented Aug 24, 2018

Could you maybe add a test where it fails with current code and works with your PR?

@jimmywarting

This comment has been minimized.

Copy link
Contributor Author

jimmywarting commented Aug 24, 2018

Done

Copy link
Member

DiegoRBaquero left a comment

LGTM

@DiegoRBaquero DiegoRBaquero merged commit a57e9f3 into webtorrent:master Aug 24, 2018
3 checks passed
3 checks passed
WIP ready for review
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@DiegoRBaquero

This comment has been minimized.

Copy link
Member

DiegoRBaquero commented Aug 24, 2018

I'm glad you could figure the tests out

@jimmywarting jimmywarting deleted the jimmywarting:feature/file_downloaded branch Aug 24, 2018
@jimmywarting

This comment has been minimized.

Copy link
Contributor Author

jimmywarting commented Aug 24, 2018

Thanks, i have never tried tape before, and i didn't know i needed to look into webtorrent-fixtures but I am good at reverse engineering :)

@lock lock bot locked as resolved and limited conversation to collaborators Nov 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.