co-cat
v0.1.2
Published
Concatenate co generator streams
Downloads
5
Readme
co-cat
Concatenate co generator streams.
Example
var cat = require('co-cat');
var co = require('co');
co(function*(){
var read = cat(twice('foo'), twice('bar'), twice('baz'));
var data;
while (data = yield read()) console.log(data);
})();
function twice(str){
var i = 0;
return function*(end){
if (end) return;
if (++i <3) return str;
}
}
Outputs:
$ node --harmony example
foo
foo
bar
bar
baz
baz
Installation
$ npm install co-cat
API
cat(stream, ..)
cat(streams)
Concatenate an array of streams of each arg stream and return a stream.
License
MIT