Skip to content

Commit cfb0b8c

Browse files
YspritanHyzygyclaude
authored andcommitted
doc: document stream.isDestroyed()
`stream.isDestroyed()` has been exported since v19.9.0 but was never documented, while its siblings `isErrored()`, `isReadable()` and `isWritable()` all have entries in `doc/api/stream.md`. Unlike those, `isDestroyed()` rejects Web streams: it returns `null` for anything that is not a Node.js stream. The accepted types are therefore documented as `Readable|Writable|Duplex` rather than also listing `ReadableStream`/`WritableStream`. Refs: #45671 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: YspritanHyzygy <yspritan@gmail.com> PR-URL: #64789 Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 826828b commit cfb0b8c

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

doc/api/stream.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3120,6 +3120,19 @@ console.log(res); // prints 'HELLOWORLD'
31203120
For convenience, the [`readable.compose(stream)`][] method is available on
31213121
{Readable} and {Duplex} streams as a wrapper for this function.
31223122

3123+
### `stream.isDestroyed(stream)`
3124+
3125+
<!-- YAML
3126+
added:
3127+
- v19.9.0
3128+
- v18.17.0
3129+
-->
3130+
3131+
* `stream` {Readable|Writable|Duplex}
3132+
* Returns: {boolean|null} - Only returns `null` if `stream` is not a valid `Readable`, `Writable` or `Duplex`.
3133+
3134+
Returns whether the stream has been destroyed.
3135+
31233136
### `stream.isErrored(stream)`
31243137

31253138
<!-- YAML

0 commit comments

Comments
 (0)