$ gnpm install command-exists
node module to check if a command-line command exists
npm install command-exists
var commandExists = require('command-exists');
commandExists('ls', function(err, commandExists) {
if(commandExists) {
// proceed confidently knowing this command is available
}
});
var commandExists = require('command-exists');
// invoked without a callback, it returns a promise
commandExists('ls')
.then(function(command){
// proceed
}).catch(function(){
// command doesn't exist
});
var commandExistsSync = require('command-exists').sync;
// returns true/false; doesn't throw
if (commandExistsSync('ls')) {
// proceed
} else {
// ...
}
Removes unnecessary printed output on windows.
Small bugfixes.
Fix windows bug introduced in 1.2.4.
Fix potential security issue.
Add support for promises
Add synchronous version
Support for windows
Copyright 2013 - present © cnpmjs.org | Home |