README.md 1.07 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
command-exists
==============

node module to check if a command-line command exists



## installation

```bash
npm install command-exists
```

## usage

### async

```js
var commandExists = require('command-exists');

commandExists('ls', function(err, commandExists) {

    if(commandExists) {
        // proceed confidently knowing this command is available
    }

});
```
### promise
```js
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
});
```

### sync
```js
var commandExistsSync = require('command-exists').sync;
// returns true/false; doesn't throw
if (commandExistsSync('ls')) {
    // proceed
} else {
    // ...
}

```


## changelog

### v1.2.7

Removes unnecessary printed output on windows.

### v1.2.6

Small bugfixes.

### v1.2.5

Fix windows bug introduced in 1.2.4.

### v1.2.4

Fix potential security issue.

### v1.2.0

Add support for promises

### v1.1.0

Add synchronous version

### v1.0.2

Support for windows