Skip to content

Commit 611d5b4

Browse files
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 384e1b5 commit 611d5b4

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

doc/api/stream.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2914,6 +2914,18 @@ Calling `Readable.from(string)` or `Readable.from(buffer)` will not have
29142914
the strings or buffers be iterated to match the other streams semantics
29152915
for performance reasons.
29162916

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

29192931
<!-- YAML
@@ -3044,6 +3056,18 @@ A utility method for creating duplex streams.
30443056
* `Promise` converts into readable `Duplex`. Value `null` is ignored.
30453057
* Returns: {stream.Duplex}
30463058

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

30493073
<!-- YAML

0 commit comments

Comments
 (0)