cmd-exec
Installation:
To install, go to your console/terminal and run:
npm install cmd-exec
Usage:
In your project, require the package:
var cmd = ;
This will return a new instance of the cmd-exec module.
To use multiple instances of cmd-exec:
var cmd1 cmd2; cmd1 = ;// is not the same as...cmd2 = ;
To execute a command, use:
cmd;
The cmd object returns a promise object:
cmd ;
It also triggers a callback, once the command has been executed:
cmd;
Both promises and callbacks are included so that you can implement whichever one best suits your project's code-style.
Returned objects:
The res
object contains two properties:
res.messages
is the stdout from the commandres.exitCode
is the exit code from the command (if specified)
The err
object contains a standard Javascript error:
err.messages
is the error's message