Skip to content
This repository has been archived by the owner on Oct 31, 2018. It is now read-only.

through versus Transform in node 0.10+ #20

Open
jeromew opened this issue Jan 13, 2014 · 2 comments
Open

through versus Transform in node 0.10+ #20

jeromew opened this issue Jan 13, 2014 · 2 comments

Comments

@jeromew
Copy link

jeromew commented Jan 13, 2014

Hello,

As I understand it this project has existed since long before the Streams2 API landed in node 0.10

I have a hard time understanding the difference between throughand the now native Transform implementation (http://nodejs.org/api/stream.html#stream_class_stream_transform_1)

is compat with node 0.8 really such a big thing now ?
couldn't through be implemented more simply as a wrapper to Tranform where

through(write, end)
<=>
Transform({objectMode: true})
 _write = write
 _end = end

I hope my question makes sense

@dominictarr
Copy link
Owner

Almost.

If you want a stream2 version of a through-like api checkout through2

streams1 are a lot simpler than streams2, with much less code,
and streams1 still works. Basically, I see very little to be gained by rewriting this when streams1 stuff still works fine.

@jeromew
Copy link
Author

jeromew commented Jan 13, 2014

Thank you for you answer. I understand.

I am a firm believer of the stream approach to things (congratulations on event-stream it is a great project I discovered it through gulp).

corner cases in streaming code are always complex and there are so many ways to do it wrong;
The benefit I see to stream2 is purely from a developer usability perspective as having one standardized way is simpler to grasp than 2 different ways that have to keep interoperable.

It already takes time to choose npm modules in the node ecosystem ; finding quality stream modules is even harder (except yours of course ;-) and I think it is hard to expect that new developers will create quality stream modules by following examples I there are 2 ways of doing things.

Learning by example in this stream field is hard because of those 2 APIs and I wish everything was streams1 or stream2 but not "stream1.5"

If you need help in de-fragmenting this I can probably spend some time on it.

would it make sense ? you seem to be very involved in the stream community in node. Am I the only one thinking that this fragmentation slows the learning of new contributors ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants