Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: api/stream.md typo from writeable to writable #28822

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -2504,23 +2504,23 @@ readable.on('data', (chunk) => {

#### Piping to Writable Streams from Async Iterators

In the scenario of writing to a writeable stream from an async iterator,
In the scenario of writing to a writable stream from an async iterator,
it is important to ensure the correct handling of backpressure and errors.

```js
const { once } = require('events');

const writeable = fs.createWriteStream('./file');
const writable = fs.createWriteStream('./file');

(async function() {
for await (const chunk of iterator) {
// Handle backpressure on write().
if (!writeable.write(chunk))
await once(writeable, 'drain');
if (!writable.write(chunk))
await once(writable, 'drain');
}
writeable.end();
writable.end();
// Ensure completion without errors.
await once(writeable, 'finish');
await once(writable, 'finish');
})();
```

Expand All @@ -2533,13 +2533,13 @@ then piped via `.pipe()`:
```js
const { once } = require('events');

const writeable = fs.createWriteStream('./file');
const writable = fs.createWriteStream('./file');

(async function() {
const readable = Readable.from(iterator);
readable.pipe(writeable);
readable.pipe(writable);
// Ensure completion without errors.
await once(writeable, 'finish');
await once(writable, 'finish');
})();
```

Expand Down