# command-exists-promise

> Checks whether a command line command exists in the current environment.

Latest version **2.0.2** (published 2019-05-09) · MIT license · 0 weekly downloads

## Install

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

## 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 | 2.0.2 |
| Published | 2019-05-09 |
| First published | 2019-05-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/command-exists-promise) |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 0 |
| Unpacked size | 5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Raphaël Thériault |
| Maintainers | raftario |
| Keywords | cli, command, exists, promise, async |

## Links

- npm: https://www.npmjs.com/package/command-exists-promise
- Repository: https://github.com/raftario/command-exists
- npm.io page: https://npm.io/package/command-exists-promise

## 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

- 2.0.2 (latest) — 2019-05-09
- 2.0.1 — 2019-05-09
- 2.0.0 — 2019-05-09

## README

# command-exists-promise
![npm](https://img.shields.io/npm/v/command-exists-promise.svg) ![Travis (.com)](https://img.shields.io/travis/com/raftario/command-exists.svg?label=travis+build) ![AppVeyor](https://img.shields.io/appveyor/ci/raftario/command-exists.svg?label=appveyor+build)  
Node module to check if a command-line command exists.
Forked from [command-exists](https://github.com/mathisonian/command-exists).
## Installation
```console
# For npm users
$ npm i command-exists-promise

# For yarn users
$ yarn add command-exists-promise
```
## Usage
The function returns a promise that will resolve to `true` if the command exists and `false` if it doesn't.  
On UNIX, the promise will resolve to `true` if the command is a path to an executable file. On Windows, it will resolve to `true` for any existing file.
### Promise
```js
const commandExists = require('command-exists-promise')

commandExists('ls')
  .then(exists => {
    if (exists) {
      // The command exists
    } else {
      // The command doesn't exist
    }
  })
  .catch(err => {
    // Should never happen but better handle it just in case
  })
```
### Await
```js
const commandExists = require('command-exists-promise')

try {
  const exists = await commandExists('ls')
  if (exists) {
    // The command exists
  } else {
    // The command doesn't exist
  }
} catch (err) {
  // Should never happen but better handle it just in case
}
```

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