-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Closed
Labels
streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.
Description
Hi, I am trying to consume a readable with a for await
loop.
When I create the simple stream below, the console output the error straight away instead of logging the data events first. Is it the expected behavior
Version: v12.9.1
Platform: Darwin Kernel Version 18.7.0
const { Readable } = require('stream')
async function* generate() {
yield 1
yield 2
yield Promise.reject('Boum')
}
;(async () => {
try {
for await (const d of Readable.from(generate())) {
console.log(d)
}
} catch (e) {
console.log(e)
}
})()
the output is
Boum
instead of the expected
1
2
Boum
Metadata
Metadata
Assignees
Labels
streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.