tubing

Simple Pipelines

tubing

Simple Pielines

npm install tubing
var tubing = require('tubing');
 
function readFile(cmddone) {
  require('fs').readFile(cmd.path, function(errdata) {
    if (err) return done(err);
    cmd.content = data;
    done();
  });
}
 
function removeNewLines(cmddone) {
  cmd.content = cmd.content.replace(/\n/g, '');
  done()
}
 
var TestPipeline = tubing.pipeline('Test Pipeline')
  .then(readFile)
  .then(removeNewLines);
 
var loggingSink = tubing.sink(function(errcmd) {
  if (err) return console.log(err.stack);
  console.log(cmd);
});
 
var pipeline = TestPipeline.configure().publish_to(loggingSink);
pipeline.push({path: '/tmp/foo.txt'});

Copyright (c) 2013 Matt Insler Licensed under the MIT license.