Repository navigation
Conversation
With forceStream, a consumer slower than the parser (a piped destination under backpressure, or a 'data'/'end' based iterator such as the one in exceljs) still has entries in the readable buffer when the writable side finishes. Emitting 'end' manually at that point made pipe() end the destination early and the remaining entries were silently lost. Let the native 'end' fire once the buffer is drained instead.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Parseemittedendmanually on writablefinish(added in End stream before closing & Prefer req.destroy() before req.abort() if available #274 for In Node v18 or higher: unzipper.Parse({forceStream: true}) throws Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close | SOLVED #269 / async iteration example no longer works in Node 18x, 19x #273), even when entries were still buffered on the readable side for a slow consumerforceStream, a piped destination under backpressure or anend-based iterator lost every entry still in the buffer:pipe()ended the destination earlyendis emitted manually only when the buffer is empty; otherwisepush(null)lets the nativeendfire after the consumer reads everything, so theentryevent mode keeps its behaviourforceStreamSlowConsumer.js: without the fix the destination receives 1 of 6 entriesFixes #191
Related to #234, #269, #273, #274
Downstream
masterwithunzipper@0.10.14: its streaming reader spec fails as published and passes once this same fix is applied tolib/parse.js(exceljs integration suite 196/196)Test plan
npm test: 108 passing, 1 pending (Node 24)eslint lib test: clean