diff options
author | Robert Nagy <ronagy@icloud.com> | 2021-08-02 14:08:32 +0300 |
---|---|---|
committer | Robert Nagy <ronagy@icloud.com> | 2021-08-06 08:45:38 +0300 |
commit | 4832d1c02c8caf3269c5e3f7bfe750f65885c34c (patch) | |
tree | 584536e969331073d71214be07031e21ce509e23 /doc/api | |
parent | 0e841b45c2fc7babef16b9810877287f8123f563 (diff) |
stream: add isDisturbed helper
Adds a helper util used to determine whether a stream has been
disturbed (read or cancelled).
Refs: https://github.com/nodejs/node/issues/39627
PR-URL: https://github.com/nodejs/node/pull/39628
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'doc/api')
-rw-r--r-- | doc/api/stream.md | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/doc/api/stream.md b/doc/api/stream.md index 047e1687d2e..f002b4af8f7 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -1261,16 +1261,27 @@ added: v11.4.0 Is `true` if it is safe to call [`readable.read()`][stream-read], which means the stream has not been destroyed or emitted `'error'` or `'end'`. +##### `readable.readableAborted` +<!-- YAML +added: REPLACEME +--> + +> Stability: 1 - Experimental + +* {boolean} + +Returns whether the stream was destroyed or errored before emitting `'end'`. + ##### `readable.readableDidRead` <!-- YAML added: REPLACEME --> +> Stability: 1 - Experimental + * {boolean} -Allows determining if the stream has been or is about to be read. -Returns true if `'data'`, `'end'`, `'error'` or `'close'` has been -emitted. +Returns whether `'data'` has been emitted. ##### `readable.readableEncoding` <!-- YAML @@ -2046,6 +2057,18 @@ added: REPLACEME * `signal` {AbortSignal} * Returns: {stream.Readable} +### `stream.Readable.isDisturbed(stream)` +<!-- YAML +added: REPLACEME +--> + +> Stability: 1 - Experimental + +* `stream` {stream.Readable|ReadableStream} +* Returns: `boolean` + +Returns whether the stream has been read from or cancelled. + ### `stream.Readable.toWeb(streamReadable)` <!-- YAML added: REPLACEME |