Skip to content

Commit

Permalink
doc: Readable unpipe on Writable error event
Browse files Browse the repository at this point in the history
PR-URL: #18080
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
GeorgeSapkin authored and addaleax committed Mar 5, 2018
1 parent 1b32fc3 commit 459f209
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 @@ -1496,6 +1499,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 459f209

Please sign in to comment.