Skip to content

doc: document stream.isDestroyed() - #64789

Open
YspritanHyzygy wants to merge 1 commit into
nodejs:mainfrom
YspritanHyzygy:doc-stream-isdestroyed
Open

doc: document stream.isDestroyed()#64789
YspritanHyzygy wants to merge 1 commit into
nodejs:mainfrom
YspritanHyzygy:doc-stream-isdestroyed

Conversation

@YspritanHyzygy

@YspritanHyzygy YspritanHyzygy commented Jul 27, 2026

Copy link
Copy Markdown

stream.isDestroyed() has been exported from lib/stream.js since v19.9.0 (#45671) but has never been documented, while the sibling helpers exported alongside it — isErrored(), isReadable() and isWritable() — all have entries.

added: was determined by checking lib/stream.js at each release tag rather than from the landing date, since the commit predates the releases that carry it:

tag released Stream.isDestroyed present
v19.8.1 2023-03-15 no
v19.9.0 2023-04-05 yes
v18.16.0 2023-04-10 no
v18.17.0 2023-07-10 yes (backport)

v20.0.0 inherited it from main rather than adding it, so it is not listed — matching how isErrored() lists only v17.3.0 and its v16.14.0 backport.

One difference is worth calling out, because it affects the documented types: unlike isErrored() and isReadable(), isDestroyed() bails out on anything that is not a Node.js stream (if (!isNodeStream(stream)) return null), so Web streams are not accepted:

isDestroyed(new Readable({ read() {} }));  // false
isDestroyed(destroyedReadable);            // true
isDestroyed(new ReadableStream());         // null
isDestroyed({});                           // null

The entry therefore lists Readable|Writable|Duplex and reuses the {boolean|null} wording already established by isReadable() and isWritable().

make lint-md and make doc-only both pass locally.

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. stream Issues and PRs related to the stream subsystem. labels Jul 27, 2026
`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: nodejs#45671
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: YspritanHyzygy <yspritan@gmail.com>
@YspritanHyzygy
YspritanHyzygy force-pushed the doc-stream-isdestroyed branch from 6aca481 to 156cbce Compare July 27, 2026 18:28
@YspritanHyzygy

Copy link
Copy Markdown
Author

Corrected the added: metadata after your approval, sorry for the churn. stream.isDestroyed() first shipped in v19.9.0, not v20.0.0 — v19.8.1 does not have the export and v19.9.0 does, and it was backported to v18.17.0 (v18.16.0 does not have it). v20.0.0 inherited it from main rather than adding it. The PR description now has the per-tag check.

Only the YAML block changed; the entry text is unchanged.

@YspritanHyzygy

Copy link
Copy Markdown
Author

test-linux (ubuntu-24.04) failed with The hosted runner lost communication with the server, which isn't a test failure — no test reports a failure anywhere in the log, and test-linux (ubuntu-24.04-arm) passed on the same commit. Could someone re-run that job? I don't have permission to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Issues and PRs related to the documentations. stream Issues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants