i-process
v1.0.3
Published
[![NPM](https://nodei.co/npm/i-process.png?downloads=true&downloadRank=true)](https://nodei.co/npm/i-process/)
Downloads
1
Readme
i-process
Installing
npm install --save i-process
Usage examples
Linux shell
var iProcess = require("i-process");
// create check function
var Hash = function (name, callback) {
var result = false;
var hash = new iProcess("bash", ["./hash.bash", name]);
hash.on("line", function (line) {
if (line.indexOf("true") !== -1) result = true;
});
hash.on("error", function (data) {
throw new Error;
});
hash.on("close", function () {
callback(result);
});
};
// usage
Hash("nmap", function (result) {
if (result) {
//...
}
});
hash.bash source:
#!/bin/bash
hash $1 2>/dev/null && echo "true"
Chess engine
var stockfish = new iProcess("./stockfish_8_x64");
stockfish.on("line", function (line) {
//...
});
stockfish.write("position startpos\n");
stockfish.write("go movetime 10000\n");