Skip to content

Commit d59398f

Browse files
addaleaxBridgeAR
authored andcommitted
zlib: use .bytesWritten instead of .bytesRead
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>
1 parent e176e26 commit d59398f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

doc/api/deprecations.md

+10
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,16 @@ Type: Documentation-only (supports [`--pending-deprecation`][])
822822
Using `process.binding()` in general should be avoided. The type checking
823823
methods in particular can be replaced by using [`util.types`][].
824824
825+
<a id="DEP0108"></a>
826+
### DEP0108: zlib.bytesRead
827+
828+
Type: Documentation-only
829+
830+
Deprecated alias for [`zlib.bytesWritten`][]. This original name was chosen
831+
because it also made sense to interpret the value as the number of bytes
832+
read by the engine, but is inconsistent with other streams in Node.js that
833+
expose values under these names.
834+
825835
[`--pending-deprecation`]: cli.html#cli_pending_deprecation
826836
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
827837
[`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array

0 commit comments

Comments
 (0)