Skip to content

Commit fd7e4ab

Browse files
tilgovibengl
authored andcommitted
doc: fix async iterable pipeline signal examples
Fix the pipeline examples to show that async generators receive an AbortSignal wrapped in an object. PR-URL: #42258 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 96dc591 commit fd7e4ab

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

doc/api/stream.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2469,7 +2469,7 @@ const fs = require('fs');
24692469
async function run() {
24702470
await pipeline(
24712471
fs.createReadStream('lowercase.txt'),
2472-
async function* (source, signal) {
2472+
async function* (source, { signal }) {
24732473
source.setEncoding('utf8'); // Work with strings rather than `Buffer`s.
24742474
for await (const chunk of source) {
24752475
yield await processChunk(chunk, { signal });
@@ -2493,7 +2493,7 @@ const fs = require('fs');
24932493

24942494
async function run() {
24952495
await pipeline(
2496-
async function * (signal) {
2496+
async function* ({ signal }) {
24972497
await someLongRunningfn({ signal });
24982498
yield 'asd';
24992499
},

0 commit comments

Comments
 (0)