From 57b412c00818114e702a79571e4ef7618b8069ad Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Thu, 16 Dec 2021 14:32:02 +0100 Subject: [PATCH] stream: add isReadable helper --- doc/api/stream.md | 13 +++++++++++++ lib/internal/streams/utils.js | 7 +++++-- lib/internal/webstreams/readablestream.js | 5 +++++ test/parallel/test-whatwg-readablestream.js | 18 ++++++++++++++++-- 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index 2b1035f1874aa4..a2e3754e25d92c 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -2238,6 +2238,19 @@ added: REPLACEME Returns whether the stream has encountered an error. +### `stream.isReadable(stream)` + + + +> Stability: 1 - Experimental + +* `stream` {Readable|Duplex|ReadableStream} +* Returns: {boolean} + +Returns whether the stream is readable. + ### `stream.Readable.toWeb(streamReadable)`