Skip to content

Commit

Permalink
doc: Readable unpipe on Writable error event
Browse files Browse the repository at this point in the history
Backport-PR-URL: #22380
PR-URL: #18080
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
GeorgeSapkin authored and MylesBorins committed Sep 6, 2018
1 parent ce66b02 commit 7f6e0b3
Showing 1 changed file with 6 additions and 0 deletions.
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 @@ -1485,6 +1488,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

0 comments on commit 7f6e0b3

Please sign in to comment.