Skip to content

Commit f1d486a

Browse files
committed
fixup! docs: fix stream async iterator sample
1 parent 3fda730 commit f1d486a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

doc/api/stream.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2650,10 +2650,10 @@ const writable = fs.createWriteStream('./file');
26502650
async function pump(iterable, writable) {
26512651
for await (const chunk of iterable) {
26522652
// Handle backpressure on write().
2653-
if (writable.destroyed) return;
2654-
if (!writable.write(chunk)) {}
2653+
if (!writable.write(chunk)) {
2654+
if (writable.destroyed) return;
26552655
await once(writable, 'drain');
2656-
if (writable.destroyed) return;
2656+
}
26572657
}
26582658
writable.end();
26592659
}

0 commit comments

Comments
 (0)