Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-03-17 18:59:54 +0300
committerRuben Bridgewater <ruben@bridgewater.de>2018-04-10 01:36:26 +0300
commit49fd9c63d21c8c42a110996a6a68bf1fdcee12b4 (patch)
tree1ce3f7768a33e36ed6807f27d470407563f8275c /doc/api/zlib.md
parentcc6abc6e84b96fd5f1c4123066eba93ddb637e60 (diff)
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: https://github.com/nodejs/node/pull/19414 Refs: https://github.com/nodejs/node/issues/8874 Refs: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'doc/api/zlib.md')
-rw-r--r--doc/api/zlib.md24
1 files changed, 20 insertions, 4 deletions
diff --git a/doc/api/zlib.md b/doc/api/zlib.md
index 4a9103a9793..0a554b40afe 100644
--- a/doc/api/zlib.md
+++ b/doc/api/zlib.md
@@ -400,13 +400,28 @@ class of the compressor/decompressor classes.
### zlib.bytesRead
<!-- YAML
added: v8.1.0
+deprecated: REPLACEME
-->
+> Stability: 0 - Deprecated: Use [`zlib.bytesWritten`][] instead.
+
* {number}
-The `zlib.bytesRead` property specifies the number of bytes read by the engine
-before the bytes are processed (compressed or decompressed, as appropriate for
-the derived class).
+Deprecated alias for [`zlib.bytesWritten`][]. This original name was chosen
+because it also made sense to interpret the value as the number of bytes
+read by the engine, but is inconsistent with other streams in Node.js that
+expose values under these names.
+
+### zlib.bytesWritten
+<!-- YAML
+added: REPLACEME
+-->
+
+* {number}
+
+The `zlib.bytesWritten` property specifies the number of bytes written to
+the engine, before the bytes are processed (compressed or decompressed,
+as appropriate for the derived class).
### zlib.close([callback])
<!-- YAML
@@ -763,7 +778,8 @@ Decompress a chunk of data with [Unzip][].
[InflateRaw]: #zlib_class_zlib_inflateraw
[Inflate]: #zlib_class_zlib_inflate
[Memory Usage Tuning]: #zlib_memory_usage_tuning
+[options]: #zlib_class_options
[Unzip]: #zlib_class_zlib_unzip
[`UV_THREADPOOL_SIZE`]: cli.html#cli_uv_threadpool_size_size
-[options]: #zlib_class_options
+[`zlib.bytesWritten`]: #zlib_zlib_byteswritten
[zlib documentation]: https://zlib.net/manual.html#Constants