Skip to content

Commit 8b518ed

Browse files
陈刚mcollina
authored andcommitted
doc: readable.push(undefined) in non-object mode
`readable.push()` supports `undefined` in non-object mode, but it was not previously documented. PR-URL: #18283 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent cae4182 commit 8b518ed

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

doc/api/stream.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,6 +1808,10 @@ class SourceWrapper extends Readable {
18081808
The `readable.push()` method is intended be called only by Readable
18091809
Implementers, and only from within the `readable._read()` method.
18101810

1811+
For streams not operating in object mode, if the `chunk` parameter of
1812+
`readable.push()` is `undefined`, it will be treated as empty string or
1813+
buffer. See [`readable.push('')`][] for more information.
1814+
18111815
#### Errors While Reading
18121816

18131817
It is recommended that errors occurring during the processing of the
@@ -2323,6 +2327,7 @@ contain multi-byte characters.
23232327
[`stream.uncork()`]: #stream_writable_uncork
23242328
[`stream.unpipe()`]: #stream_readable_unpipe_destination
23252329
[`stream.wrap()`]: #stream_readable_wrap_stream
2330+
[`readable.push('')`]: #stream_readable_push
23262331
[`writable.cork()`]: #stream_writable_cork
23272332
[`writable.uncork()`]: #stream_writable_uncork
23282333
[`zlib.createDeflate()`]: zlib.html#zlib_zlib_createdeflate_options

0 commit comments

Comments
 (0)