Skip to content

Commit

Permalink
doc: readable.push(undefined) in non-object mode
Browse files Browse the repository at this point in the history
`readable.push()` supports `undefined` in non-object mode, but it was
not previously documented.

PR-URL: nodejs#18283
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
  • Loading branch information
陈刚 authored and jasnell committed Aug 17, 2018
1 parent f56a4ba commit 08ccba7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -1740,6 +1740,10 @@ class SourceWrapper extends Readable {
*Note*: The `readable.push()` method is intended be called only by Readable
Implementers, and only from within the `readable._read()` method.

For streams not operating in object mode, if the `chunk` parameter of
`readable.push()` is `undefined`, it will be treated as empty string or
buffer. See [`readable.push('')`][] for more information.

#### Errors While Reading

It is recommended that errors occurring during the processing of the
Expand Down Expand Up @@ -2259,6 +2263,7 @@ contain multi-byte characters.
[`stream.uncork()`]: #stream_writable_uncork
[`stream.unpipe()`]: #stream_readable_unpipe_destination
[`stream.wrap()`]: #stream_readable_wrap_stream
[`readable.push('')`]: #stream_readable_push
[`writable.cork()`]: #stream_writable_cork
[`writable.uncork()`]: #stream_writable_uncork
[`zlib.createDeflate()`]: zlib.html#zlib_zlib_createdeflate_options
Expand Down

0 comments on commit 08ccba7

Please sign in to comment.