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: add comments about Readable unpipe on Writable error event in stream.md #18080

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
6 changes: 6 additions & 0 deletions doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ The `'unpipe'` event is emitted when the [`stream.unpipe()`][] method is called
on a [Readable][] stream, removing this [Writable][] from its set of
destinations.

This is also emitted in case this [Writable][] stream emits an error when a
[Readable][] stream pipes into it.

```js
const writer = getWritableStreamSomehow();
const reader = getReadableStreamSomehow();
Expand Down Expand Up @@ -1533,6 +1536,9 @@ the callback and passing the error as the first argument. This will cause an
on how the stream is being used. Using the callback ensures consistent and
predictable handling of errors.

If a Readable stream pipes into a Writable stream when Writable emits an
error, the Readable stream will be unpiped.

```js
const { Writable } = require('stream');

Expand Down