From 3f0973f1ed36a6f7f18944e5b4650fbc063e972a Mon Sep 17 00:00:00 2001 From: George Sapkin Date: Thu, 8 Feb 2018 09:22:02 +0100 Subject: [PATCH] doc: Readable unpipe on Writable error event PR-URL: https://github.com/nodejs/node/pull/18080 Reviewed-By: Matteo Collina Reviewed-By: James M Snell --- doc/api/stream.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/api/stream.md b/doc/api/stream.md index b312e0f483f06d..23bb97ea286c50 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -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(); @@ -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');