Skip to content

mk-pmb/stdio-duplex-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published