Echo JS 0.11.0

<~>
xat 2765 days ago. link parent 2 points
What exactly is wrong with modules like through2? IMHO they are just tiny wrappers, which make handling streams more enjoyable. These are the stream modules I usually use in my projects: through2, from2, end-of-stream, pump and duplexify. Some of them handle some weird edge-cases, which would really not be that much fun to implement manually each time.

Here is also a nice collection of stream utilities: https://github.com/maxogden/mississippi

Replies

tracker1 2764 days ago. link 1 point
because `require('stream').Through` pretty much does everything through2 does...

    new Transform({
      objectMode: true,
      transform(chunk, enc, cb) {},
      flush(cb) {}
    });

Is there something through2 inherently does that this doesn't?

The internals provide... I mean, you can either inherit from the template streams, or you can use streams that actually serve a purpose..  Readable handles backpressure by default, not sure why you'd want from2 or through2 ... end-of-stream comes down to knowing when to listen for 'end' (readable/through) and 'finish' (writable).

pump actually seems to serve a purpose... as does the likes of split2, and others... but the most basic readable/transform/writable bases are covered in the box, and it's really better to use them than bring in potentially a bunch of extra dependencies.
xat 2763 days ago. link 1 point
I agree with you that it may not make that much sense to use through2.

Generally I don't really mind pulling in small dependencies, even if they make stuff only a bit nicer. As long as the dependencies are easy replaceable and their code is understandable.