Cmdin is a simple wrapper over the node child_process.exec()
utilizing ES6 Promises to execute shell commands.
npm install cmdin --save
The most simplest usage is as follows:
const cmd = require('cmdin');
cmd.run('ls').then((res) => {
console.log(res.stdout);
}).catch(e => {
console.log(e);
});
Arguments can be written inline:
cmd.run('ls -a -l').then((res) => {
console.log(res.stdout);
}).catch(e => {
console.log(e);
});
or passed as an array structure:
cmd.run('ls',['-l', '-a']).then((res) => {
console.log(res.stdout);
}).catch(e => {
console.log(e);
});