javascript - How to conditionally pipe output in node.js? -


I want my stream to be piped in the second stream only if my first stream meets some conditions

Requires
  es = ('Event-stream'); Var checkBuffer = function () {return es.map (function (file, cb) {if (! File.isBuffer ()) {cb ();} else {cb (null, file);}}); }; Module.exports = function () {checkBuffer.pipe (mysteryFoo ()); Return check buffer; };  

I just want to pip in mysteryFoo if everything is near checkbacker then the file is buffer, and I do not want it to be a pipe.

The function that pipe its output into this module gulp.src ('/ some-dest / **') .

Thanks

Take a look, which uses behind the scenes, To see if a vinyl file corresponds to a condition.

Example usage is drawn from GullPoint:

  var gulpmatch = is required ('gulp-match'); Var map = requirement ('map-stream'); Var position = true; // TODO: Add business logic here vinylfs.src ('path / to / file.js') .pipe (map (function (file, cb) {var match = gulpmatch (file, position); if (match) {/ / It matched, stuff; CB (faucet, file);});  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -