command-exists

check whether a command line command exists in the current environment

Potential security vulnerability fixed in v.1.2.4
Last updated 7 years ago by mathisonian .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install command-exists 
SYNC missed versions from official npm registry.

command-exists

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 promise
commandExists('ls')
.then(function(command){
    // proceed
}).catch(function(){
    // command doesn't exist
});

sync

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

Current Tags

  • 1.2.9                                ...           latest (5 years ago)

16 Versions

  • 1.2.9                                ...           5 years ago
  • 1.2.8                                ...           6 years ago
  • 1.2.7                                ...           6 years ago
  • 1.2.6                                ...           7 years ago
  • 1.2.5                                ...           7 years ago
  • 1.2.4                                ...           7 years ago
  • 1.2.3 [deprecated]           ...           7 years ago
  • 1.2.2 [deprecated]           ...           8 years ago
  • 1.2.1 [deprecated]           ...           8 years ago
  • 1.2.0 [deprecated]           ...           8 years ago
  • 1.1.0 [deprecated]           ...           8 years ago
  • 1.0.2 [deprecated]           ...           8 years ago
  • 1.0.1 [deprecated]           ...           9 years ago
  • 1.0.0 [deprecated]           ...           9 years ago
  • 0.1.1 [deprecated]           ...           9 years ago
  • 0.1.0 [deprecated]           ...           10 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (3)

Copyright 2013 - present © cnpmjs.org | Home |