Skip to content

Commit eef7489

Browse files
marco-ippolitoRafaelGSS
authored andcommitted
doc: duplex and readable from uncaught execption warning
PR-URL: #46135 Fixes: #46071 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent c77b0da commit eef7489

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

doc/api/stream.md

+24
Original file line numberDiff line numberDiff line change
@@ -2912,6 +2912,18 @@ Calling `Readable.from(string)` or `Readable.from(buffer)` will not have
29122912
the strings or buffers be iterated to match the other streams semantics
29132913
for performance reasons.
29142914

2915+
If an `Iterable` object containing promises is passed as an argument,
2916+
it might result in unhandled rejection.
2917+
2918+
```js
2919+
const { Readable } = require('node:stream');
2920+
2921+
Readable.from([
2922+
new Promise((resolve) => setTimeout(resolve('1'), 1500)),
2923+
new Promise((_, reject) => setTimeout(reject(new Error('2')), 1000)), // Unhandled rejection
2924+
]);
2925+
```
2926+
29152927
### `stream.Readable.fromWeb(readableStream[, options])`
29162928

29172929
<!-- YAML
@@ -3042,6 +3054,18 @@ A utility method for creating duplex streams.
30423054
* `Promise` converts into readable `Duplex`. Value `null` is ignored.
30433055
* Returns: {stream.Duplex}
30443056

3057+
If an `Iterable` object containing promises is passed as an argument,
3058+
it might result in unhandled rejection.
3059+
3060+
```js
3061+
const { Duplex } = require('node:stream');
3062+
3063+
Duplex.from([
3064+
new Promise((resolve) => setTimeout(resolve('1'), 1500)),
3065+
new Promise((_, reject) => setTimeout(reject(new Error('2')), 1000)), // Unhandled rejection
3066+
]);
3067+
```
3068+
30453069
### `stream.Duplex.fromWeb(pair[, options])`
30463070

30473071
<!-- YAML

0 commit comments

Comments
 (0)