Skip to content

Commit 396b85b

Browse files
committed
doc: clarify fromReadable() duck-typed contract
Document that duck-typed readable inputs must provide off() in addition to read() and on(), matching the cleanup behavior in the implementation. Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
1 parent 9e58d9d commit 396b85b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

doc/api/stream_iter.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,7 +1469,7 @@ added: v26.1.0
14691469
> Stability: 1 - Experimental
14701470
14711471
* `readable` {stream.Readable|Object} A classic Readable stream or any object
1472-
with `read()` and `on()` methods.
1472+
with `read()`, `on()`, and `off()` methods.
14731473
* Returns: {AsyncIterable\<Uint8Array\[]>} A stream/iter async iterable source.
14741474

14751475
Converts a classic Readable stream (or duck-typed equivalent) into a
@@ -1478,8 +1478,8 @@ stream/iter async iterable source that can be passed to [`from()`][],
14781478

14791479
If the object implements the [`toAsyncStreamable`][] protocol (as
14801480
`stream.Readable` does), that protocol is used. Otherwise, the function
1481-
duck-types on `read()` and `on()` (EventEmitter) and wraps the stream with
1482-
a batched async iterator.
1481+
duck-types on `read()`, `on()`, and `off()` (EventEmitter) and wraps the
1482+
stream with a batched async iterator.
14831483

14841484
The result is cached per instance -- calling `fromReadable()` twice with the
14851485
same stream returns the same iterable.

0 commit comments

Comments
 (0)