Iterate over a stack of streams.
This module is intended to be used with loader-cachebut may be used by itself or in other modules.
Install with npm
$ npm i iterator-streams --save
var iterator = require('iterator-streams');
Iterate over a stack of streams piping the results of each steram to the next stream in the stack.
Params
stack {Array}: Array of streams to use.returns {Function}: Returns a function that will iterator over the given stack of streams.var fs = require('fs');
var iterator = require('iterator-streams');
var through = require('through2');
var stack = [
through.obj(function (fp, enc, cb) { this.push(fs.readFileSync(fp, 'utf8')); cb(); }),
through.obj(function (contents, enc, cb) { this.push(JSON.parse(contents)); cb(); })
];
var readJSON = iterator(stack);
readJSON('./package.json')
.on('data', console.log);
Install dev dependencies:
$ npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Brian Woodward
Copyright © 2015 Brian Woodward Released under the MIT license.
This file was generated by verb-cli on June 17, 2015.