1.0.2 • Published 8 years ago

io-control v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
8 years ago

io-control

Easy control of executable i/o

Documentation

Creating a subprocess:

const ioControl = require('io-control');

let filename = 'myfile.exe';
let args = [
  '-msg',
  'hello-world'
];

let proc = new ioControl(filename, args);

Setting a callback for output:

proc.onOutput(data => {
  console.log(data);
});

Piping to another out stream:

proc.pipe(); // Default is process.stdout

Writing to the process:

proc.write("hello world");

Getting the execution step index:

console.log(proc.stepIndex);

Closing the in stream:

proc.close();

Setting a callback for program exit:

proc.onExit(exitCode => {
  console.log(exitCode); // exitCode is null if the process is closed manually
});

Error handling

proc.onError(error => {
  console.log(error); // Errors can occur if the process fails to start/exit
});

Closing the process manually:

proc.exit();
1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago