1.0.0 • Published 7 years ago

diamond-operator v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

diamond

stdin + arguments composite stream

install

npm install diamond

example

pipe stdin and content of files from command line to stdout:

var diamond = require('diamond');

diamond().pipe(process.stdout);

listen for 'next' event:

var diamond = require('diamond');

var stream = diamond();

stream.on('data', function(d) {
     console.log('data:', d);
});
stream.on('end', function() {
     console.log('end');
});
stream.on('next', function() {
    console.log('next stream!', stream.name);
});

by default, process.argv.slice(2) is used as list of files. You can pass your own list:

var program = require('commander');
var diamond = require('diamond');

program
  .version('0.0.1')
  .option('-c', 'Count chars')
  .option('-l,', 'Count lines')
  .parse(process.argv);

var stream = diamond(program.args);
// ...

Bitdeli Badge