bustle / bluestream

A collection of streams that work well with promises (through, map, reduce). Think Through2 with promises
MIT License
103 stars 5 forks source link

readAsync(x) helper function #6

Closed reconbot closed 6 years ago

reconbot commented 7 years ago

I'd love to be able to do this

const stream = new ReadableStream()
const data = await bstream.readAsync(stream, 5)

And have data be 5 bytes, or 5 objects (depending on the mode) There are times where it would be helpful to remove the first bit of data before piping it off elsewhere.

CodeMan99 commented 6 years ago

Some references.

It seems like stream-shift would be of most use. I have used first-chunk-stream in combination with get-stream for identifying the file-type.

reconbot commented 6 years ago

@CodeMan99 this is a good list, but none of them quite do what I want here. I landed readAsync in #26