-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
quick fix for already-ended streams #29
Conversation
Travis e-mailed me. I see you're intending to support down to nodejs 4. This fix only passed my test on nodejs 8 and above. I don't know how to detect whether a stream has ended on nodejs 4. |
Streams can be many versions due to readable-stream existing so we support a vast majority of them. This a non trivial problem. What's your real life use-case for this? |
I'm trying to robustly pull the next item from a stream and throw an error if there is none. https://npmjs.com/package/stream-shift-promise (as part of a library and tool that uses streams a lot). I'm not personally worried about versions of npm no longer generally distributed, but I was kind of hoping if I could find another project to merge the idea into it might get better maintenance down the road, with more users. EDIT: It sounds like for this idea to be merged, you'd need me to review all the forms of streams that use this library and make it work for them? Do you know if this is possible for them all? |
I'm trying to make a tool for probing forms of blockchain data. It seemed it would be nice to use streams under the hood, since the size range of stuff can vary from miniscule to humongous. I was running into a lot of issues connecting streams together so I started working on libraries. EDIT: If I offer everything as a stream, the function is useful for retrieving only the first item if it is the only one of interest. I then hope to get backflow propagating back up so no more data need be generated. But if the request is bad the stream will be empty before it is shifted from. |
Yea this module got massive usage in the ecosystem so we gonna have to test a wide variety of streams to not break stuff. I think any change made to here in the last 12-24 months has caused breakage hehe. The reason I'm asking about a use case is that I don't think I've had the need to listen for stream end some time after making the stream instance. You gotta error handle it right away anyway. I normally check using stream.destroyed if a stream has error if I need to check that. |
I don't quite understand you. I am trying to use streams to hold all of one value, huge values, and no values, so setting up error handlers would be encapsulated inside something. It sounds like this is not the place, or maybe streams not the tool. Thank you. |
This is a naive attempt for something that fixes #28