From 783967675bc6122a2a1b67e98b1e8a9bfb8ad026 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Tue, 7 Jan 2020 22:59:54 +0100 Subject: [PATCH] doc: rename iterator to iterable in examples PR-URL: https://github.com/nodejs/node/pull/31252 Fixes: https://github.com/nodejs/node/issues/31222 Reviewed-By: Matteo Collina Reviewed-By: Rich Trott Reviewed-By: James M Snell --- doc/api/stream.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index cdb2095aef1e85..c807f1ecbaa51a 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -2639,8 +2639,8 @@ const finished = util.promisify(stream.finished); const writable = fs.createWriteStream('./file'); -async function pump(iterator, writable) { - for await (const chunk of iterator) { +async function pump(iterable, writable) { + for await (const chunk of iterable) { // Handle backpressure on write(). if (!writable.write(chunk)) { if (writable.destroyed) return; @@ -2653,7 +2653,7 @@ async function pump(iterator, writable) { (async function() { // Ensure completion without errors. await Promise.all([ - pump(iterator, writable), + pump(iterable, writable), finished(writable) ]); })(); @@ -2677,7 +2677,7 @@ const finished = util.promisify(stream.finished); const writable = fs.createWriteStream('./file'); (async function() { - const readable = Readable.from(iterator); + const readable = Readable.from(iterable); readable.pipe(writable); // Ensure completion without errors. await finished(writable); @@ -2692,7 +2692,7 @@ const pipeline = util.promisify(stream.pipeline); const writable = fs.createWriteStream('./file'); (async function() { - const readable = Readable.from(iterator); + const readable = Readable.from(iterable); await pipeline(readable, writable); })(); ```