Skip to content

Commit

Permalink
doc: rename iterator to iterable in examples
Browse files Browse the repository at this point in the history
PR-URL: #31252
Fixes: #31222
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
ronag authored and codebytere committed Mar 14, 2020
1 parent 6dc3c5e commit 7839676
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
]);
})();
Expand All @@ -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);
Expand All @@ -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);
})();
```
Expand Down

0 comments on commit 7839676

Please sign in to comment.