# command-exists

> check whether a command line command exists in the current environment

Latest version **1.2.9** (published 2020-04-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install command-exists
pnpm add command-exists
yarn add command-exists
bun add command-exists
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.9 |
| Published | 2020-04-15 |
| First published | 2014-09-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/command-exists) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 147 |
| Author | Matthew Conlen |
| Maintainers | mathisonian |
| Keywords | cli, command, exists |

## Links

- npm: https://www.npmjs.com/package/command-exists
- Repository: https://github.com/mathisonian/command-exists
- Issues: https://github.com/mathisonian/command-exists/issues
- npm.io page: https://npm.io/package/command-exists

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 1.2.9 (latest) — 2020-04-15
- 1.2.8 — 2018-10-13
- 1.2.7 — 2018-06-18
- 1.2.6 — 2018-04-14
- 1.2.5 — 2018-04-13
- 1.2.4 — 2018-04-12
- 1.2.3 — 2018-04-12
- 1.2.2 — 2017-02-28
- 1.2.1 — 2017-02-16
- 1.2.0 — 2017-02-10
- 1.1.0 — 2017-02-10
- 1.0.2 — 2016-07-27
- 1.0.1 — 2016-05-17
- 1.0.0 — 2016-04-23
- 0.1.1 — 2016-04-23
- … 1 more at https://npm.io/package/command-exists/versions

## README

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

---
_Source: https://npm.io/package/command-exists · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
