events for closing #37
Comments
I'm happy to add a finish event, but the reason that this doesn't "support" the new interface is because this module predated was already perfect before it existed. And regarding the new stream interface, you should also ask "which one?". "new streams" has always been backwards compatible (which made it very complicated and ugly). and if you actually go through and read the newest code, and compare it to the classic code then you'll see that how it works is basically the same. classic streams was pretty simple. the important code was only about 100 lines. I read this code many times. .pipe hooked the That said, there where a few streams2 changes that where good, like starting the steam as paused until it's piped, and could have easily been added to streams1 without making it thousands of lines. Also, in streams 2 the core node streams (fs, net, http, etc) where implemented around ReadableStream, an abstract class that provided most of the logic and made it relatively easy to implement a stream. Of course, we where already doing this in userland with streams1, using this module and others. Anyway, there are still plenty of problems with streams3, (errors are not propagated, and they are still a lot of code). In the mean time i started experimenting and we (@Raynos was instrumental) came up with pull-streams which is massively simpler, supports the best features of node streams (backpressure) but also has error propagation and is more composable. This is now what I use when I write streaming code. |
Great -- thanks so much for the info! I am relatively new to node so just started from the perspective of reading the current documentation (which isn't crystal clear :)). I will look into pull-streams... I need streams that I can use with promises -- so reliable events and/or callbacks I can wrap in a |
While looking into trying to create a proper PR to support callbacks on
write
andend
I notice that you emitend
andclose
events, but notfinish
events.I understand that you don't support the (new) node stream interface. Is this intentional?
The text was updated successfully, but these errors were encountered: