uhop / stream-chain

Chain functions as transform streams.
BSD 3-Clause "New" or "Revised" License
85 stars 11 forks source link

can not chain Node.ReadableStream #9

Closed guoh27 closed 1 year ago

guoh27 commented 1 year ago

I can not write this code in my ts file:

const stream: Node.ReadableStream = ...
chain([stream, ...])

There will has type error

guoh27 commented 1 year ago

And

const stream: Node.ReadableStream = ...
const pipeline = chain([...])
stream.pipe(pipeline)
pipeline.on('end', () => {
    console.log('end')
}

pipeline will not end after stream is ended

uhop commented 1 year ago

stream-chain does not support ReadableStream. It is a part of web streams: https://nodejs.org/api/webstreams.html

stream-chain was written for Node streams: https://nodejs.org/api/stream.html

Web Streams were added in Node 16 and are still considered experimental. I plan to add them later when they stabilize.

adamhamlin commented 7 months ago

stream-chain does not support ReadableStream. It is a part of web streams: https://nodejs.org/api/webstreams.html

stream-chain was written for Node streams: https://nodejs.org/api/stream.html

Web Streams were added in Node 16 and are still considered experimental. I plan to add them later when they stabilize.

@uhop great library! Just wanted to comment that I'm looking forward to WebStream support in the future 👍