kevva / download

Download and extract files
MIT License
1.28k stars 199 forks source link

Upgrade to latest version of got for better stream handling #208

Open jeffski opened 3 years ago

jeffski commented 3 years ago

I ran in to some issues using download and setting the got option for streaming { isStream: true }. I ran in to memory issues as I was running a script in AWS Lambda with limited memory.

I tried the same script calling got directly and got the same error.

It was only after I upgraded to the latest version of got that I was able to stream correctly without an memory issues.

The got package is now at v11, the package.json for download is at v8. It would be great if you could update to the latest version.

FeelyChau commented 3 years ago

@jeffski I committed PR for this #212

pgrzesik commented 3 years ago

We've experienced similar issues related to outdated got version, which has some troubles with handling streams. In our case, the problem was that timeout was not properly handled in case of RequestError: getaddrinfo ENOTFOUND being thrown (e.g. when user has issues with internet connection), which resulted in the process hanging for the duration of the timeout and ending with another error being thrown at the end of the timeout.

Upgrade to got@11 along with minor adjustments resolves that problem.

Steps to reproduce:

  1. Disable internet connection
  2. Try to "download" something with timeout option set, e.g. to 30 seconds