-
Notifications
You must be signed in to change notification settings - Fork 30k
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: use .bytesWritten
instead of .bytesRead
#19414
Conversation
3a5754d
to
a9427f1
Compare
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.
lib/zlib.js
Outdated
@@ -548,8 +563,8 @@ function processCallback() { | |||
var availOutAfter = state[0]; | |||
var availInAfter = state[1]; | |||
|
|||
var inDelta = (handle.availInBefore - availInAfter); | |||
self.bytesRead += inDelta; | |||
var inDelta = handle.availInBefore - availInAfter; |
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.
const
, if this line is changed to fix style?
doc/api/zlib.md
Outdated
@@ -766,4 +781,5 @@ Decompress a chunk of data with [Unzip][]. | |||
[Unzip]: #zlib_class_zlib_unzip | |||
[`UV_THREADPOOL_SIZE`]: cli.html#cli_uv_threadpool_size_size | |||
[options]: #zlib_class_options | |||
[`zlib.bytesWritten`]: #zlib_zlib_byteswritten |
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.
A nit: it seems to be out of ASCII order (if we still follow this order in references).
The introduction of `.bytesRead` to zlib streams was unfortunate, because other streams in Node.js core use the exact opposite naming of `.bytesRead` and `.bytesWritten`. While one could see how the original naming makes sense in a `Transform` stream context, we should try to work towards more consistent APIs in core for these things. This introduces `zlib.bytesWritten` and documentation-only deprecates `zlib.bytesRead`. (Luckily, the old property name hasn’t even been around for a whole year yet.) Refs: nodejs#8874 Refs: nodejs#13088
d460811
to
bf5e4ee
Compare
The introduction of `.bytesRead` to zlib streams was unfortunate, because other streams in Node.js core use the exact opposite naming of `.bytesRead` and `.bytesWritten`. While one could see how the original naming makes sense in a `Transform` stream context, we should try to work towards more consistent APIs in core for these things. This introduces `zlib.bytesWritten` and documentation-only deprecates `zlib.bytesRead`. PR-URL: nodejs#19414 Refs: nodejs#8874 Refs: nodejs#13088 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Landed in 49fd9c6 🎉 |
The introduction of `.bytesRead` to zlib streams was unfortunate, because other streams in Node.js core use the exact opposite naming of `.bytesRead` and `.bytesWritten`. While one could see how the original naming makes sense in a `Transform` stream context, we should try to work towards more consistent APIs in core for these things. This introduces `zlib.bytesWritten` and documentation-only deprecates `zlib.bytesRead`. PR-URL: #19414 Refs: #8874 Refs: #13088 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
The introduction of `.bytesRead` to zlib streams was unfortunate, because other streams in Node.js core use the exact opposite naming of `.bytesRead` and `.bytesWritten`. While one could see how the original naming makes sense in a `Transform` stream context, we should try to work towards more consistent APIs in core for these things. This introduces `zlib.bytesWritten` and documentation-only deprecates `zlib.bytesRead`. PR-URL: nodejs#19414 Refs: nodejs#8874 Refs: nodejs#13088 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
opting to not backport to v8.x, please lmk if this is a mistake |
The introduction of
.bytesRead
to zlib streams was unfortunate,because other streams in Node.js core use the exact opposite naming
of
.bytesRead
and.bytesWritten
.While one could see how the original naming makes sense in
a
Transform
stream context, we should try to work towards moreconsistent APIs in core for these things.
This introduces
zlib.bytesWritten
and documentation-only deprecateszlib.bytesRead
.(Luckily, the old property name hasn’t even been around for a whole
year yet.)
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes