Skip to content
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

Ignore unexpected EOF errors #1

Merged
merged 1 commit into from Sep 6, 2016
Merged

Ignore unexpected EOF errors #1

merged 1 commit into from Sep 6, 2016

Conversation

kevva
Copy link
Contributor

@kevva kevva commented Sep 6, 2016


res.emit('error', err);
});

res.on('close', function () {
unzip.emit('close');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, not sure you should use unzip.emit('close') here, end is probably better.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it better? I've yet to figure out the difference. Wouldn't res.end() be more correct then?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, seems there's no official way: http://stackoverflow.com/questions/19277094/how-to-close-a-readable-stream-before-end Node.js streams really are the worst...

Copy link
Contributor Author

@kevva kevva Sep 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've encountered less inconsistencies when using end rather than close. I actually tested using res.emit('close') at first, but then it never exited.

Wouldn't res.end() be more correct then?

Yes. If it's a writable stream, res.end() wouldn't work since it's a readable.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do this in a major bump, just to be sure.

@sindresorhus sindresorhus merged commit c434b79 into master Sep 6, 2016
@sindresorhus sindresorhus deleted the fix-eof branch September 6, 2016 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants