From d0f905bd6f7408cfe3759b203cf4d85df389dd56 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Wed, 11 Jan 2023 09:16:27 +0100 Subject: [PATCH] doc: duplex and readable from uncaught execption warning PR-URL: https://github.com/nodejs/node/pull/46135 Fixes: https://github.com/nodejs/node/issues/46071 Reviewed-By: Paolo Insogna Reviewed-By: Matteo Collina --- doc/api/stream.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/doc/api/stream.md b/doc/api/stream.md index 613a0b7c87a8d6..2d0103349121f6 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -2890,6 +2890,18 @@ Calling `Readable.from(string)` or `Readable.from(buffer)` will not have the strings or buffers be iterated to match the other streams semantics for performance reasons. +If an `Iterable` object containing promises is passed as an argument, +it might result in unhandled rejection. + +```js +const { Readable } = require('node:stream'); + +Readable.from([ + new Promise((resolve) => setTimeout(resolve('1'), 1500)), + new Promise((_, reject) => setTimeout(reject(new Error('2')), 1000)), // Unhandled rejection +]); +``` + ### `stream.Readable.fromWeb(readableStream[, options])`