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

Show a simple status line while downloading #1984

Closed
wants to merge 4 commits into from

Conversation

KennethKinLum
Copy link

What is the purpose of this pull request? (put an "X" next to item)

[X] Documentation update
[ ] Bug fix
[ ] New feature
[ ] Other, please explain:

What changes did you make? (Give an overview)
Show a simple status line while downloading

Which issue (if any) does this pull request address?
Since it may take 20 minutes or even an hour or a few hours to finish downloading, it may be good to see a status, to see that at least the downloading has started and what speed it is going on with.

This shows a simple status line as to what speed it is moving along and what percentage is done.

Is there anything you'd like reviewers to focus on?

Since it may take 20 minutes or even an hour or a few hours to finish downloading, it may be good to see a status, to see that at least the downloading has started and what speed it is going on with.

This shows a simple status line as to what speed it is moving along and what percentage is done.
})

torrent.on('download', function (bytes) {
if (!isDone) process.stdout.write(`\rtotal: ${torrent.length} progress: ${(client.progress * 100).toFixed(2)}% ${Math.round(client.downloadSpeed / 1024).toFixed(1)} KB/s downloading...`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there is any need in adding this condition.

Every time the event download is called, is because you have downloaded something.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested and it does seem that without isDone you will continue to get a few download calls showing the progress after done is called. Is this what you are experiencing as well?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aha, at first I didn't have the isDone, and after the "Done" message is printed, then there is one additional progress message that got printed that messed up the screen. If the event occurs such that the progress always happens first, and then the done occurs, then there is no need for the isDone flag.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could defer done to next event loop to solve this

Copy link
Member

@alxhotel alxhotel Jul 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I agree @DiegoRBaquero (I have created an issue for this #2143)

Copy link

@whothisbeme whothisbeme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this LGTM however I usually like to see total downloaded/total size, download speed, upload speed, peers, and progress as well. Also, it would be cool to see an ETA from the timeRemaining property. I tried adding minutes & seconds but it doesn't look that good IMO.

I use a separate function usually to convert to human readable ETA however it isn't a one-liner.

Maybe someone has a better solution for the milliseconds to ETA format?

Also, not sure why the downloadSpeed is coming from the client and not the torrent object?

docs/get-started.md Outdated Show resolved Hide resolved
use torrent's `downloadSpeed` and `progress`
@DiegoRBaquero DiegoRBaquero force-pushed the master branch 2 times, most recently from 8c15c98 to d78055b Compare May 21, 2021 16:49
@github-actions
Copy link

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

@github-actions github-actions bot added the stale label Jul 21, 2021
@github-actions github-actions bot closed this Jul 29, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants