From 46092fba7914c70f5c438301f2a484bbdf378ae4 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Thu, 9 Dec 2021 09:15:12 +0100 Subject: [PATCH] stream: add isErrored helper Refs: https://github.com/nodejs/undici/pull/1134 --- doc/api/stream.md | 13 +++++++++++++ lib/internal/streams/utils.js | 14 ++++++++++++++ lib/internal/webstreams/readablestream.js | 4 ++++ lib/stream.js | 1 + test/parallel/test-stream-readable-didRead.js | 7 +++++-- test/parallel/test-whatwg-readablestream.js | 17 +++++++++++++++++ 6 files changed, 54 insertions(+), 2 deletions(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index 8ca8fb1db5c0f1..5934ceae100e36 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -2225,6 +2225,19 @@ added: v16.8.0 Returns whether the stream has been read from or cancelled. +### `stream.Readable.isErrored(stream)` + + + +> Stability: 1 - Experimental + +* `stream` {stream.Readable|ReadableStream} +* Returns: `boolean` + +Returns whether the stream has been errored. + ### `stream.Readable.toWeb(streamReadable)`