caolan / highland

High-level streams library for Node.js and the browser
https://caolan.github.io/highland
Apache License 2.0
3.43k stars 147 forks source link

Possible to unpipe highland.js streams? #471

Open nicwsm opened 8 years ago

nicwsm commented 8 years ago

Hi,

Just curious, is it possible to .unpipe a highland.js stream? If yes, how should I do it? Thanks.

For example..

h().unpipe(stream)

I have two different streams, and I want to unpipe the writable from the readable stream without affecting the other streams still piped to the readable streams..

vqvu commented 8 years ago

There is no unpipe method. You should transform the Highland stream into a node stream (by piping to PassThrough if you want to use node stream features that Highland doesn't provide.

// You may need to specify objectMode and/or highWaterMark depending on your use case.
var stream = h(...).pipe(new PassThrough());
stream.pipe(....);

// Later on.
stream.unpipe(...);