0.1.2 • Published 7 years ago
stdio-duplex v0.1.2
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 withError: process.stdout cannot be closed.
- NB: Trying to
err
: (bool) Send output to stderr instead of stdout. Default:false
lines
: (bool) Split stdin into lines. Default:false
License
ISC