-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Invoke-WebRequest: Display downloaded bytes in human readable format and display total expected download size #14611
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
Invoke-WebRequest: Display downloaded bytes in human readable format and display total expected download size #14611
Conversation
…and display total expected download size
src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/StreamHelper.cs
Outdated
Show resolved
Hide resolved
...ft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebResponseObject.Common.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/StreamHelper.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/StreamHelper.cs
Outdated
Show resolved
Hide resolved
…ade it exceed 100%
…to InvokeWebrequest-Progress
…re. Replace "0 Bytes" with "???" when download size is not known
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
…o InvokeWebrequest-Progress
|
@PoshChan please retry macos |
|
@bergmeister, did not find matching build context: |
|
@bergmeister can you rebase and force push to force rerunning CI? Edit: Nevermind, got it restarted. |
|
This is much more an Interactive UX decision than core cmdlets and personally whilst I can see where @iSazonov is coming from re the Therefore I'd happily approve this PR on behalf of the Interactive UX Working Group. I would however ask to see the differences in end package size to this PR and one based on the comments that @iSazonov is concerned about because honestly I can't see it making enough of a difference to not allow this PR through as it is |
|
@bergmeister I know it's been a long time, and you may have lost the interest in updating this PR. But, if not, could you please address #14611 (comment)? Or, I can help updating the PR. |
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
Definitely still interested, I just addressed that comment from Keith that you wanted me to do e8532db |
daxian-dbw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bergmeister It looks good to me overall with 2 comments. Please take a look when you get a chance. Thanks!
src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/StreamHelper.cs
Outdated
Show resolved
Hide resolved
|
@daxian-dbw Have you already looked at the animation in the description of this PR or have you done an actual experiment? Do you see how the bar flickers? How the scale changes? After that, do you really think it's great UX? This is a nightmare. |
…Cmdlet/StreamHelper.cs as per suggestion Co-authored-by: Dongbo Wang <dongbow@microsoft.com>
…path to come last
|
@iSazonov I built and played with the changes in this PR, and it looks pretty nice to me. As for the blinking cursor bar, that's out of the scope of this PR, but something powershell can handle, for example, make the cursor invisible when rendering the progress bar.
I'm not sure what you mean by "scale changes", but the new UX is much better than the old UX in my opinion. Old
|
daxian-dbw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@daxian-dbw Could you please also share screenshots for bytes, TB and PB too? I would really like to see how this code works. If it can't be done, why this dead code? MB is the only thing we need. |
|
I agree it should be super rare to download a package with the TB or PB size, but I'm fine keeping those switch branches in
|
@iSazonov, I'm not sure that this comment is useful, especially considering that we aren't just trying to get rid of "dead code" but trying to have code that is useful now and in the future too |
|
@iSazonov Given the discussion above, I will merge this PR as is. |
|
@VozdyxDev Glad you're looking forward to using this feature. This feature didn't make it into 7.3 because it was too close to its release from a testing/risk perspective. It is in the preview of 7.4 though if you already want to use it. |
|
Oh, thanks for the info) |





PR Summary
1 KBas 1024, it should probably use 1024 as the base for KB, MB, etc. The number of significant digits is 1 for KB, 2 for MB, 3 for GB, etc.Note that because of the
-Resumeparameter, there can be special edge cases where the number of downloaded bytes is greater than the total download size, hence whyMath.Min(x, 100)has to be used when setting thePercentCompleteproperty of theProgressRecord.Demo:

PR Context
Fixes #14610
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.