Skip to main content
ReadableBase.prototype.unpipe - node__stream.d.ts - Node documentation
method ReadableBase.prototype.unpipe

Usage in Deno

```typescript import { ReadableBase } from "node:node__stream.d.ts"; ```
ReadableBase.prototype.unpipe(destination?: WritableStream): this
The `readable.unpipe()` method detaches a `Writable` stream previously attached using the pipe method. If the `destination` is not specified, then _all_ pipes are detached. If the `destination` is specified, but no pipe is set up for it, then the method does nothing. ```js import fs from 'node:fs'; const readable = getReadableStreamSomehow(); const writable = fs.createWriteStream('file.txt'); // All the data from readable goes into 'file.txt', // but only for the first second. readable.pipe(writable); setTimeout(() => { console.log('Stop writing to file.txt.'); readable.unpipe(writable); console.log('Manually close the file stream.'); writable.end(); }, 1000); ```

Parameters

optional
destination: WritableStream
Optional specific stream to unpipe

Return Type

this