Skip to content

juliangruber/co-cat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

co-cat

Concatenate co generator streams.

build status

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