The
readable.unpipe() method in a Readable Stream is used to detach a Writable stream which was previously attached while using the stream.pipe() method.
Syntax:
readable.unpipe( destination )
Parameters: This method accepts single parameter
destination which is the destination of writable stream to be detached.
Return Value: It returns stream.Writable i.e, the destination.
Below examples illustrate the use of
readable.unpipe() method in Node.js:
Example 1:
Output:
done
Example 2:
Output:
done
Stop writing to output.text.
close the file stream.
Reference: https://nodejs.org/api/stream.html#stream_readable_unpipe_destination.