Skip to content

Commit d0f905b

Browse files
marco-ippolitojuanarbol
authored andcommitted
doc: duplex and readable from uncaught execption warning
PR-URL: #46135 Fixes: #46071 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent 8fac4c5 commit d0f905b

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
@@ -2890,6 +2890,18 @@ Calling `Readable.from(string)` or `Readable.from(buffer)` will not have
28902890
the strings or buffers be iterated to match the other streams semantics
28912891
for performance reasons.
28922892

2893+
If an `Iterable` object containing promises is passed as an argument,
2894+
it might result in unhandled rejection.
2895+
2896+
```js
2897+
const { Readable } = require('node:stream');
2898+
2899+
Readable.from([
2900+
new Promise((resolve) => setTimeout(resolve('1'), 1500)),
2901+
new Promise((_, reject) => setTimeout(reject(new Error('2')), 1000)), // Unhandled rejection
2902+
]);
2903+
```
2904+
28932905
### `stream.Readable.fromWeb(readableStream[, options])`
28942906

28952907
<!-- YAML
@@ -3020,6 +3032,18 @@ A utility method for creating duplex streams.
30203032
* `Promise` converts into readable `Duplex`. Value `null` is ignored.
30213033
* Returns: {stream.Duplex}
30223034

3035+
If an `Iterable` object containing promises is passed as an argument,
3036+
it might result in unhandled rejection.
3037+
3038+
```js
3039+
const { Duplex } = require('node:stream');
3040+
3041+
Duplex.from([
3042+
new Promise((resolve) => setTimeout(resolve('1'), 1500)),
3043+
new Promise((_, reject) => setTimeout(reject(new Error('2')), 1000)), // Unhandled rejection
3044+
]);
3045+
```
3046+
30233047
### `stream.Duplex.fromWeb(pair[, options])`
30243048

30253049
<!-- YAML

0 commit comments

Comments
 (0)