stdio-duplex

0.1.2 • Public • Published

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

Package Sidebar

Install

npm i stdio-duplex

Weekly Downloads

1

Version

0.1.2

License

ISC

Last publish

Collaborators

  • mk-pmb