-
Notifications
You must be signed in to change notification settings - Fork 1
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
Use 'stream' instead of '_stream_transform' #2
Conversation
Hey thanks for the patch. First, this library is not really maintained, any reason you reached for this instead of through2? Second, I think the reason I wrote this originally was because I was using it in the browser and wanted to cut down on bundle size - so it probably still makes sense to pull in the dep directly which is slightly more compact than grabbing the entire package. See how through2 does it for example: |
I thought that might be what you were going for, but I don't think it is because https://github.com/nodejs/readable-stream/blob/master/transform.js#L1 just kind of undoes any advantage. And before you think changing it to get That being said, I suppose the thing to do would be to actually try both approaches and look at the resulting bundle size. Maybe I'm missing something.
50% less characters! :) Actually... At some point a couple years ago I realized that a) All I ever use are object streams, b) through2.obj keeps making me have an "enc" argument that I never use. So I wrote my own module with the reduced feature set I actually used, and thought "wouldn't it be need if I published it as |
Yeah it just doesn’t pull in pass-through. Not a huge thing but why not save a few bytes? |
For the record, I have done an actual comparison (using You are indeed correct. The change I proposed would bump the bundled size from 140.8kb to 143.2kb. That's 2.4kb more for very little benefit. As much as it pains me to see weird private Node core APIs with underscores... I think the correct approach to close #1 is to get "_stream_transform" added to |
How does |
That could have its own pitfalls though, a direct dep on |
Fixes #1