# esc-exit

> Exit the process when the `esc` key is pressed

Latest version **3.0.1** (published 2023-12-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install esc-exit
pnpm add esc-exit
yarn add esc-exit
bun add esc-exit
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2023-12-04 |
| First published | 2014-04-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=12 |
| Dependencies | 0 |
| Unpacked size | 2.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 59 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | esc, exit, process, key, press, stdin, readline, event, escape, cli, tool |

## Links

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

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 3.0.1 (latest) — 2023-12-04
- 3.0.0 — 2021-04-07
- 2.0.2 — 2019-05-18
- 2.0.1 — 2018-11-06
- 2.0.0 — 2018-05-02
- 1.0.1 — 2018-03-23
- 1.0.0 — 2014-08-13
- 0.2.0 — 2014-05-25
- 0.1.0 — 2014-04-05

## README

# esc-exit

> Exit the process when the <kbd>esc</kbd> key is pressed

Useful for CLI tools to let the user press <kbd>esc</kbd> or <kbd>control+c</kbd> to get out.

## Install

```sh
npm install esc-exit
```

## Usage

```js
import escExit from 'esc-exit';

escExit();
```

## API

Using this prevents the process from exiting normally.

There are multiple ways you can handle this:

- Call the unsubscribe method that `escExit()` returns when you're done listening. It will then let the process exit normally.

- Call `process.exit()` to exit the process directly.

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