question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invoke-webrequest unable to download large files - stream too long

See original GitHub issue

Hi,

This is half a feature request/bug.

When downloading very large files (> 1GB), Invoke-Webrequest will:

  • usually crash with a stream too long exception,
  • consume huge amount of memory, going beyound 2.5GB or RAM used.

Which make this commandlet unsuited for something that would work flawlessly on wget.

Do you have any plans on improving this? How complex would this feature be?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
orcinuscommented, May 2, 2023

This is still a problem in 2023. PowerShell is a ridiculous joke at this point.

1reaction
jborean93commented, Jun 2, 2021

You need to specify -OutFile to store the data into a file and bypass this problem. The default behaviour is to store the response in memory and that has limits as you’ve encountered.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Powershell - Why is Using Invoke-WebRequest Much ...
The reason this improves performance here is because Invoke-WebRequest (and Invoke-RestMethod ) count the downloaded bytes too often (every ...
Read more >
windows server 2012 r2 - Download big files with PowerShell
Invoke -WebRequest was designed for small files and it's speed is very slow. Note that BITS can show progress, because Write-Progress cmdlet can ......
Read more >
Invoke-webrequest downloads a few kb and stops
In order to download a file, Invoke-WebRequest isn't the most optimal way as the HTTP response stream is buffered into memory, and once...
Read more >
Invoke-WebRequest timer, need advice :] : r/PowerShell
My problem is when I use invoke-restmethod it fails the download because there's not enough ram on the computer to store it, then...
Read more >
PowerShell wget : Awesome Way to Download a File
Learn how to leverage PowerShell like a PowerShell wget to download a file URL in this step-by-step demo tutorial.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found