From b05ac87368b7693012c0e0bc98c4fb2eaf47cd2b Mon Sep 17 00:00:00 2001 From: Randall Leeds Date: Tue, 8 Mar 2022 12:28:00 -0800 Subject: [PATCH 1/2] doc: fix async iterable pipeline signal examples Fix the pipeline examples to show that async generators receive an AbortSignal wrapped in an object. --- doc/api/stream.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index d59cd6b51629e4..baf63750f4eaaf 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -2532,7 +2532,7 @@ const fs = require('fs'); async function run() { await pipeline( fs.createReadStream('lowercase.txt'), - async function* (source, signal) { + async function* (source, { signal }) { source.setEncoding('utf8'); // Work with strings rather than `Buffer`s. for await (const chunk of source) { yield await processChunk(chunk, { signal }); @@ -2556,7 +2556,7 @@ const fs = require('fs'); async function run() { await pipeline( - async function * (signal) { + async function * ({ signal }) { await someLongRunningfn({ signal }); yield 'asd'; }, From 31c98253bbc34a10944b2c6f229f7af319bd3801 Mon Sep 17 00:00:00 2001 From: Randall Leeds Date: Wed, 9 Mar 2022 11:03:08 -0800 Subject: [PATCH 2/2] doc: remove an extra space in doc/api/stream.md Remove an extra space around a generator function signature in the async iterable pipeline examples. Co-authored-by: Antoine du Hamel --- doc/api/stream.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index baf63750f4eaaf..5528286a98e60e 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -2556,7 +2556,7 @@ const fs = require('fs'); async function run() { await pipeline( - async function * ({ signal }) { + async function* ({ signal }) { await someLongRunningfn({ signal }); yield 'asd'; },