From 156cbce64860d786ed3423c798f77664db8f3ae9 Mon Sep 17 00:00:00 2001 From: YspritanHyzygy Date: Mon, 27 Jul 2026 09:41:36 -0400 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/45671 Co-Authored-By: Claude Opus 5 Signed-off-by: YspritanHyzygy --- doc/api/stream.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/api/stream.md b/doc/api/stream.md index 2f7fd7961a7334..6a5300c6e0e095 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -3120,6 +3120,19 @@ console.log(res); // prints 'HELLOWORLD' For convenience, the [`readable.compose(stream)`][] method is available on {Readable} and {Duplex} streams as a wrapper for this function. +### `stream.isDestroyed(stream)` + + + +* `stream` {Readable|Writable|Duplex} +* Returns: {boolean|null} - Only returns `null` if `stream` is not a valid `Readable`, `Writable` or `Duplex`. + +Returns whether the stream has been destroyed. + ### `stream.isErrored(stream)`