merge2 icon indicating copy to clipboard operation
merge2 copied to clipboard

Accept fn for lazy sequential streams

Open richardscarrott opened this issue 6 years ago • 0 comments

I haven't looked into the implementation of merge2 yet but wondered whether it would be possible to accept a function (() => Stream), allowing streams to be lazy, e.g.

const pipeline1 = () => readable1.pipe(transform1); // Lazy
const pipeline2 = () => readable2.pipe(transform2); // Lazy
merge(pipeline1, pipeline2).pipe(writable); // `readable2` is not read from until `pipeline1` is finished

richardscarrott avatar Jan 09 '20 18:01 richardscarrott