node module to check if a command-line command exists
installation
npm install command-exists
usage
async
var commandExists = require('command-exists');commandExists('ls', function(err, commandExists) { if(commandExists) { // proceed confidently knowing this command is available }});
promise
var commandExists = require('command-exists');// invoked without a callback, it returns a promisecommandExists('ls').then(function(command){ // proceed}).catch(function(){ // command doesn't exist});