0.0.1 • Published 10 years ago

parallel-ware-pipe v0.0.1

Weekly downloads
9
License
-
Repository
github
Last release
10 years ago

parallel-ware-pipe

A plugin factory for parallel-ware that waits for data to become available, and then pipes that data to another function.

Installation

$ npm install parallel-ware-pipe

Example

var parallel = require('parallel-ware');
var pipe = require('parallel-ware-pipe');

parallel()
  .use(weather)
  .use(pipe('degrees', write))
  .run({ zip: '18708 ');

function weather (data, callback) {
  request
    .get('https://weather.com/api/' + data.zip)
    .end(function (err, res) {
      data.degrees = res.body.degrees;
      callback();
    });
}

function write (degrees, callback) {
  fs.writeFile('degrees.txt', degrees, callback);
}

License

MIT