# buffered-spawn

> Buffered child process#spawn.

Latest version **3.3.2** (published 2016-09-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install buffered-spawn
pnpm add buffered-spawn
yarn add buffered-spawn
bun add buffered-spawn
```

## 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 | 3.3.2 |
| Published | 2016-09-14 |
| First published | 2014-06-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 9 |
| Author | IndigoUnited |
| Maintainers | satazor, wibblymat, paulirish, sheerun, sindresorhus |
| Keywords | buffered-spawn, buffer, spawn, buffered, exec, execute, path_ext |

## Links

- npm: https://www.npmjs.com/package/buffered-spawn
- Repository: https://github.com/IndigoUnited/node-buffered-spawn
- Homepage: https://github.com/IndigoUnited/node-buffered-spawn#readme
- Issues: https://github.com/IndigoUnited/node-buffered-spawn/issues/
- npm.io page: https://npm.io/package/buffered-spawn

## Dependencies (1)

- [cross-spawn](https://npm.io/package/cross-spawn.md) ^4.0.0

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 3.3.2 (latest) — 2016-09-14
- 3.3.1 — 2016-09-14
- 3.3.0 — 2016-09-14
- 3.2.0 — 2016-04-13
- 3.1.0 — 2016-04-06
- 3.0.0 — 2016-02-20
- 2.0.4 — 2016-02-10
- 2.0.2 — 2016-01-03
- 2.0.1 — 2016-01-02
- 2.0.0 — 2016-01-02
- 1.1.2 — 2015-07-11
- 1.1.1 — 2015-06-22
- 1.1.0 — 2015-03-23
- 1.0.1 — 2015-02-08
- 1.0.0 — 2014-08-14
- … 6 more at https://npm.io/package/buffered-spawn/versions

## README

# buffered-spawn

[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url]

[npm-url]:https://npmjs.org/package/buffered-spawn
[downloads-image]:http://img.shields.io/npm/dm/buffered-spawn.svg
[npm-image]:http://img.shields.io/npm/v/buffered-spawn.svg
[travis-url]:https://travis-ci.org/IndigoUnited/node-buffered-spawn
[travis-image]:http://img.shields.io/travis/IndigoUnited/node-buffered-spawn/master.svg
[david-dm-url]:https://david-dm.org/IndigoUnited/node-buffered-spawn
[david-dm-image]:https://img.shields.io/david/IndigoUnited/node-buffered-spawn.svg
[david-dm-dev-url]:https://david-dm.org/IndigoUnited/node-buffered-spawn#info=devDependencies
[david-dm-dev-image]:https://img.shields.io/david/dev/IndigoUnited/node-buffered-spawn.svg

Buffered child_process#spawn.


## Installation

`$ npm install buffered-spawn`


## Why

- Easy to use
- Uses [cross-spawn](http://github.com/IndigoUnited/node-cross-spawn) by default, which fixes windows [issues](https://github.com/joyent/node/issues/2318)
- Supports callback & promise style


## Usage

In terms of arguments, they are equal to node's [spawn](http://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).

```js
const bufferedSpawn = require('buffered-spawn');

// Callback style
bufferedSpawn('git', ['clone', 'git@github.com/bower/bower'], { cwd: '.' }, (err, stdout, stderr) => {
    if (err) {
        // Both stdout and stderr are also set on the error object
        return console.error(`Command failed with error code of #${err.status}`);
    }

    console.log(stdout);
    console.log(stderr);
});

// ...or Promise style
bufferedSpawn('git', ['clone', 'git@github.com/bower/bower'], { cwd: '.' })
.then((output) => {
    console.log(output.stdout);
    console.log(output.stderr);
}, (err) => {
    // Both stdout and stderr are also set on the error object
    console.error(`Command failed with error code of #${err.status}`);
});
```

The actual child process is available if necessary:

```js
const buffspawn('buffered-spawn');

// Callback style
const cp = buffspawn('git', ['clone', 'git@github.com/bower/bower'], () => {}};

// ...or Promise style
const promise = buffspawn('git', ['clone', 'git@github.com/bower/bower']);
const cp = promise.cp;
```

As said before, `buffered-spawn` uses `cross-spawn` to actually spawn the process. If you are having trouble running Windows such as [wmic](https://msdn.microsoft.com/en-us/library/bb742610.aspx) which has its own arguments parser, you may disable like so:

```js
const cp = buffspawn('wmic', [
    'logicaldisk', 'where', 'DeviceID="Z:"',
    'get' 'freeSpace,size'
], { crossSpawn: false }, () => {}};
```

## Tests

`$ npm test`


## License

Released under the [MIT License](http://www.opensource.org/licenses/mit-license.php).

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