Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

i-process

alexismaster13ISC1.0.3

NPM

readme

i-process

NPM

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");