# process-exists

> Check if a process is running

Latest version **5.0.0** (published 2021-11-04) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2021-11-04 |
| First published | 2015-06-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | ^12.20.0 \|\| ^14.13.1 \|\| >=16.0.0 |
| Dependencies | 1 |
| Unpacked size | 4.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 62 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | process, processes, proc, ps, pid, test, testing, exists, running, check |

## Links

- npm: https://www.npmjs.com/package/process-exists
- Repository: https://github.com/sindresorhus/process-exists
- Homepage: https://github.com/sindresorhus/process-exists#readme
- Issues: https://github.com/sindresorhus/process-exists/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/process-exists

## Dependencies (1)

- [ps-list](https://npm.io/package/ps-list.md) ^8.0.0

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 5.0.0 (latest) — 2021-11-04
- 4.1.0 — 2021-07-09
- 4.0.0 — 2019-12-22
- 3.1.0 — 2018-03-01
- 3.0.0 — 2017-08-28
- 2.1.0 — 2015-10-18
- 2.0.0 — 2015-10-17
- 1.0.0 — 2015-06-20

## README

# process-exists

> Check if a process is running

## Install

```sh
npm install process-exists
```

## Usage

```js
import {processExists, processExistsMultiple, filterExistingProcesses} from 'process-exists';

console.log(await processExists(process.pid));
//=> true

const exists = await processExistsMultiple([process.pid, 'foo']);

console.log(exists.get(process.pid));
//=> true

console.log(exists.get('foo'));
//=> false

console.log(filterExistingProcesses(exists));
//=> [process.pid]
```

## API

### processExists(input)

Check if a process exists.

Returns a `Promise<boolean>`.

#### input

Type: `number | string`

The process ID or name to check.

### processExistsMultiple(input)

Check multiple processes if they exist.

Returns a `Promise<Map>` with the process name/ID as key and the status as a boolean value.

#### input

Type: `Array<number | string>`

The process IDs or names to check.

### filterExistingProcesses(input)

Filter processes that exist.

Returns an `Array<number | string>` with the processes that exist.

#### input

Type: `Array<number | string>`

The process IDs or names to check.

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