PowerShell 7.3 - implementing Using `Invoke-WebRequest` for Large Files with Timeout Errors
I'm working on a project and hit a roadblock... Quick question that's been bugging me - I'm experimenting with I'm building a feature where I'm working on a project and hit a roadblock... I'm working with a timeout behavior when trying to download large files using `Invoke-WebRequest` in PowerShell 7.3. The command Iām using is as follows: ```powershell $url = 'https://example.com/largefile.zip' $outputPath = 'C:\Downloads\largefile.zip' Invoke-WebRequest -Uri $url -OutFile $outputPath -TimeoutSec 30 ``` When I run this script, I often see the following behavior message: ``` Invoke-WebRequest : The operation has timed out. ``` I have tried increasing the `-TimeoutSec` parameter to 60 and even 120 seconds, but I still receive the timeout behavior. I've also checked my internet connection and ensured that the URL is correct, which it is since smaller files download without issues. Is there a way to handle larger file downloads more effectively? Perhaps using a different method or handling the timeout more gracefully? Any suggestions on optimizing `Invoke-WebRequest` for large files would be greatly appreciated. This is part of a larger CLI tool I'm building. How would you solve this? I'm working in a macOS environment. For reference, this is a production desktop app. What are your experiences with this? I recently upgraded to Powershell latest. I'm open to any suggestions. Is there a simpler solution I'm overlooking? I'm working with Powershell in a Docker container on CentOS. Cheers for any assistance!