0.1.2 • Published 7 years ago

stdio-duplex v0.1.2

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

stdio-duplex

Factory function for duplex streams made from process.std{in,out}.

Usage

from doc/examples/line-lengths.js:

var stdio = require('stdio-duplex')({ lines: true });
stdio.on('data', function (oneLine) {
  stdio.write(String(oneLine).length + '\n');
});

Options

The factory function takes an optional options object which supports these settings:

  • end: (bool) Whether to end stdout when stdin ends. Default: false
    • NB: Trying to .end() the original ("real") stdout will most probably fail with Error: process.stdout cannot be closed.
  • err: (bool) Send output to stderr instead of stdout. Default: false
  • lines: (bool) Split stdin into lines. Default: false

License

ISC