-
-
Notifications
You must be signed in to change notification settings - Fork 941
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
response
event don't prevent the program to output
#223
Comments
I've found this also happens when using the |
This is because |
The point is that app exit without error at all, and I'm using async.js and On the other hand, I think this is a valid use case, or is it intended to I'm asking this because I'm doing a get request and need to wait to the |
I guess we can copy |
This can be fixed in a three ways:
got.stream.get(GCC_URL)
.on('response', function(res)
{
res.pipe(fs.createWriteStream('out.tgz'))
}).resume()
got.stream.get(GCC_URL)
.on('response', function(res)
{
res.pipe(fs.createWriteStream('out.tgz'))
}).pipe(fs.createWriteStream('/dev/null'))
const input = new PassThrough();
const output = new PassThrough({highWaterMark: bytes});
const proxy = duplexer3(input, output); |
The next code exists inmediatly without waiting to fully download the file:
Check it with some big file like GCC or linux kernel, it will only write just some kilobytes and exit in just a couple of seconds. On the other hand, the next "equivalent" code works flawlessly:
I think that if a
response
event is registered it should wait until the response stream is fully consumed.The text was updated successfully, but these errors were encountered: