-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
zlib: align with streams #32220
zlib: align with streams #32220
Conversation
- Ensure automatic destruction only happens after both 'end' and 'finish' has been emitted through autoDestroy. - Ensure close() callback is always invoked. - Ensure 'error' is only emitted once.
eb857ea
to
f9dfae6
Compare
@@ -260,8 +263,7 @@ function ZlibBase(opts, mode, handle, { flush, finishFlush, fullFlush }) { | |||
} | |||
} | |||
|
|||
Transform.call(this, { autoDestroy: false, ...opts }); | |||
this._hadError = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could keep _hadError
for compat if necessary.
@nodejs/zlib |
It would be good to get another review. I would like to get this into the next v13.x release, if this is ready. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Landed in a940143 |
- Ensure automatic destruction only happens after both 'end' and 'finish' has been emitted through autoDestroy. - Ensure close() callback is always invoked. - Ensure 'error' is only emitted once. PR-URL: #32220 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
FYI @BridgeAR |
Hey @ronag, this doesn't land cleanly on v13.x, should it be backported? |
- Ensure automatic destruction only happens after both 'end' and 'finish' has been emitted through autoDestroy. - Ensure close() callback is always invoked. - Ensure 'error' is only emitted once. PR-URL: nodejs#32220 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Backport-PR-URL: nodejs#32371
It appears that as a result of this PR, const { Inflate } = require('zlib');
new Inflate().close(console.error); Prints nothing in 543c046 and I don't know whether this is expected behavior and/or whether the docs should be clearer (either about when to call |
'end' and 'finish' has been emitted through autoDestroy.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes