Skip to content

Commit d86e615

Browse files
andreasg123targos
authored andcommitted
doc: clarify documentation of pipes and zlib objects
Document how pipes can be chained in readable.pipe(). Document that zlib.Zlib inherits from stream.Transform. PR-URL: #22354 Fixes: #22341 Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent e644088 commit d86e615

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

doc/api/stream.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -895,8 +895,8 @@ added: v0.9.4
895895
* `destination` {stream.Writable} The destination for writing data
896896
* `options` {Object} Pipe options
897897
* `end` {boolean} End the writer when the reader ends. **Default:** `true`.
898-
* Returns: {stream.Writable} making it possible to set up chains of piped
899-
streams
898+
* Returns: {stream.Writable} The *destination*, allowing for a chain of pipes if
899+
it is a [`Duplex`][] or a [`Transform`][] stream
900900

901901
The `readable.pipe()` method attaches a [`Writable`][] stream to the `readable`,
902902
causing it to switch automatically into flowing mode and push all of its data

doc/api/zlib.md

+4
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,9 @@ added: v0.5.8
397397
Not exported by the `zlib` module. It is documented here because it is the base
398398
class of the compressor/decompressor classes.
399399

400+
This class inherits from [`stream.Transform`][], allowing `zlib` objects to be
401+
used in pipes and similar stream operations.
402+
400403
### zlib.bytesRead
401404
<!-- YAML
402405
added: v8.1.0
@@ -840,6 +843,7 @@ Decompress a chunk of data with [`Unzip`][].
840843
[`InflateRaw`]: #zlib_class_zlib_inflateraw
841844
[`TypedArray`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
842845
[`Unzip`]: #zlib_class_zlib_unzip
846+
[`stream.Transform`]: stream.html#stream_class_stream_transform
843847
[`zlib.bytesWritten`]: #zlib_zlib_byteswritten
844848
[Memory Usage Tuning]: #zlib_memory_usage_tuning
845849
[pool size]: cli.html#cli_uv_threadpool_size_size

0 commit comments

Comments
 (0)