Replace all .pipe calls with stream module pipeline method#370
Replace all .pipe calls with stream module pipeline method#370tomas merged 2 commits intotomas:masterfrom
Conversation
In order to automatically forward any errors that might occur within the pipeline, and properly clean up afterwards, the stream.pipeline module method is preferred.
|
Any chance you could avoid using "newer" JS syntax (arrow functions or |
Yeah sure! Do you want me to use Something like this maybe? // Now, release the kraken!
var pipelineCallback = function(error) {
if (error) debug(error);
}
var pipelineArgs = [resp].concat(pipeline).push(pipelineCallback);
stream.pipeline.apply(null, pipelineArgs); |
|
Maybe a bit shorter? function pipelineCb(err) { if (err) debug(err) }
stream.pipeline.apply(null, [resp].concat(pipeline).concat(pipelineCb));By the way, in your code, |
Yeah, you are right! I didn't run the code, I was just trying to figure out what you like first :) Making the changes. |
|
By the way, the version in needle package.json is 2.7.0 but in npm says 2.8.0. Am I missing something? The releases here also seem a bit behind. |
* Replace arrow functions with functions * Replace spread operator with .apply and Array methods
|
Yeah I probably haven't pushed some tags from my local repo. Code looks good! I'll run the test suite and merge if everything passes. |
|
Cool! Let me know If I need to make any further changes! Probably the tests need to run automatically here so you can have one less thing in your mind to do ;) |
|
Are you able to run |
|
Is there something I need in order to run the tests because if I
If you have instructions somewhere let me know so I can read them and run them locally. EDIT: never mind, found it https://github.com/tomas/needle#testing |
|
I just run ONLY the I will run the whole suite. |
|
What Node.js version? |
v12.16.1 What are you using? |
|
Tested both with |
|
I run the previous tests on my MacOSX. I just run the errors spec on my Ubuntu 16 machine with node If I try to run the whole suite, however, it does not, even if I switch to |
|
Hey @tomas, any luck running those tests in |
|
ping @tomas? |
|
Will check in a minute. A bit swamped last week! |
|
Ok, got them working. Merging! |
|
Just pushed |
|
Awesome @tomas! I am glad I've helped! Time to upgrade my dependencies ;) |
In order to automatically forward any errors that might occur within the pipeline, and properly clean up afterwards, the stream.pipeline module method is preferred.
Fixes: #368, #280