You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi
I am looking at making a little utility for creating a stream from a nodeJS readable stream , this will bring all the nice monadic interfaces of flyd (using map, chain etc is much simpler and clearer than writing transform streams...).
I am thinking of something like this:
function fromReadable(readable) {
const s = flyd.stream();
readable.on('data', s);
readable.on('end', () => s.end(true));
}
Do you forsee any issues with this? Have I lost backpressure?
Any ideas on how to handle errors?
The text was updated successfully, but these errors were encountered:
Most likely. flyd is push. Readable is pull. Implementing backpressure in push world requires some careful actions. You need to pass signals back by the pipe which is against push idea.
If you want something nice and simple like flyd but for data consuming, I think your first stop would be callbags. I think they have backpressure implemented as a specific operator and you can implement your own, bc callbag has API to signal back.
The bigger alternatives are most.js and Highland (both not being actively developed).
Hi
I am looking at making a little utility for creating a stream from a nodeJS
readable stream
, this will bring all the nice monadic interfaces of flyd (usingmap
,chain
etc is much simpler and clearer than writing transform streams...).I am thinking of something like this:
Do you forsee any issues with this? Have I lost backpressure?
Any ideas on how to handle errors?
The text was updated successfully, but these errors were encountered: