# exec-promised

> Execute commands from NodeJS using promises

Latest version **2.2.0** (published 2015-10-27) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install exec-promised
pnpm add exec-promised
yarn add exec-promised
bun add exec-promised
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2015-10-27 |
| First published | 2015-10-23 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | TimTheSinner |
| Maintainers | timthesinner |
| Keywords | promise, exec, spawn, promised, commandline, promise-exec, exec-promise |

## Links

- npm: https://www.npmjs.com/package/exec-promised
- Repository: https://github.com/timthesinner/exec-promised
- Homepage: https://github.com/timthesinner/exec-promised#readme
- Issues: https://github.com/timthesinner/exec-promised/issues
- npm.io page: https://npm.io/package/exec-promised

## Dependencies (1)

- [q](https://npm.io/package/q.md) ^1.4.1

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 2.2.0 (latest) — 2015-10-27
- 2.1.0 — 2015-10-27
- 2.0.0 — 2015-10-26
- 1.4.0 — 2015-10-25
- 1.3.0 — 2015-10-23
- 1.2.0 — 2015-10-23
- 1.1.0 — 2015-10-23
- 1.0.0 — 2015-10-23

## README

# exec-promised
Handle program execution from the promise framework in a clean way.
- Stream sysout/err through notifications instead of waiting.
- Resolve or fail the promise using the program exit code.
- Command arguments are automatically quoted.

## Getting Started

```shell
npm install exec-promised --save
```

## Example streaming output from 'ls'
```js
var exec = require('exec-promised');
var progress = require('exec-promised').progress;

exec(['ls', '-al'], '~').progress(progress).fail(function (err) {
  throw err;
});
```

## Example spawn mongodb with process cleanup
```js
var path = require('path');
var spawn = require('exec-promised').spawn;
var progress = require('exec-promised').progress;

function cleanupMongo(data) {
  //Bit of handwaving here, on Windows usually need to hack to handle SIGINT gracefully.
  // Take a look at: http://stackoverflow.com/questions/10021373/what-is-the-windows-equivalent-of-process-onsigint-in-node-js
  process.on('SIGINT', function() {
    data.close();
    process.stdout.write('');
  });
}

spawn([
  path.resolve(path.join('/', 'Program Files', 'MongoDB', 'Server', '3.0', 'bin', 'mongod.exe')),
  '--httpinterface',
], cleanupMongo).progress(progress).then(function (res) {
  console.log(res);
}).fail(function (err) {
  throw err;
});
```

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