diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2018-05-31 16:00:24 +0200 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-08-22 01:00:27 +0200 |
commit | 36468ca92862f2e1bc086be7e5e12ec8e012982b (patch) | |
tree | 5a2be2bec63ce0695f927bd20ff2d6deb0c9da9e /doc | |
parent | 9dae0ae22b62a7f6a3ebf7e5efbfac9611d5ce04 (diff) | |
download | android-node-v8-36468ca92862f2e1bc086be7e5e12ec8e012982b.tar.gz android-node-v8-36468ca92862f2e1bc086be7e5e12ec8e012982b.tar.bz2 android-node-v8-36468ca92862f2e1bc086be7e5e12ec8e012982b.zip |
lib: require a callback for end-of-stream
Make the callback mandatory as mostly done in all other Node.js
callback APIs so users explicitly have to decide what to do in error
cases.
This also documents the options for `Stream.finished()`.
When originally implemented it was missed that Stream.finished() has
an optional options object.
PR-URL: https://github.com/nodejs/node/pull/21058
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Mathias Buus <mathiasbuus@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/stream.md | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/doc/api/stream.md b/doc/api/stream.md index c42df4ee7c..f8180fa020 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -1294,12 +1294,21 @@ implementors should not override this method, but instead implement [`readable._destroy()`][readable-_destroy]. The default implementation of `_destroy()` for `Transform` also emit `'close'`. -### stream.finished(stream, callback) +### stream.finished(stream[, options], callback) <!-- YAML added: v10.0.0 --> * `stream` {Stream} A readable and/or writable stream. +* `options` {Object} + * `error` {boolean} If set to `false`, then a call to `emit('error', err)` is + not treated as finished. **Default**: `true`. + * `readable` {boolean} When set to `false`, the callback will be called when + the stream ends even though the stream might still be readable. + **Default**: `true`. + * `writable` {boolean} When set to `false`, the callback will be called when + the stream ends even though the stream might still be writable. + **Default**: `true`. * `callback` {Function} A callback function that takes an optional error argument. @@ -2438,7 +2447,7 @@ contain multi-byte characters. [zlib]: zlib.html [hwm-gotcha]: #stream_highwatermark_discrepancy_after_calling_readable_setencoding [pipeline]: #stream_stream_pipeline_streams_callback -[finished]: #stream_stream_finished_stream_callback +[finished]: #stream_stream_finished_stream_options_callback [stream-_flush]: #stream_transform_flush_callback [stream-_read]: #stream_readable_read_size_1 [stream-_transform]: #stream_transform_transform_chunk_encoding_callback |