Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/panosoft/spawn-promise
Spawns a process and makes it simple to pipe data in and get data out.
https://github.com/panosoft/spawn-promise
Last synced: about 2 months ago
JSON representation
Spawns a process and makes it simple to pipe data in and get data out.
- Host: GitHub
- URL: https://github.com/panosoft/spawn-promise
- Owner: panosoft
- Created: 2015-07-27T22:06:46.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-29T22:36:20.000Z (almost 7 years ago)
- Last Synced: 2024-09-23T12:46:34.169Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 10.7 KB
- Stars: 7
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# spawn-promise
Spawns a process and makes it simple to pipe data in and get data out.
[![npm version](https://img.shields.io/npm/v/spawn-promise.svg)](https://www.npmjs.com/package/spawn-promise)
[![npm license](https://img.shields.io/npm/l/spawn-promise.svg)](https://www.npmjs.com/package/spawn-promise)
[![Travis](https://img.shields.io/travis/panosoft/spawn-promise.svg)](https://travis-ci.org/panosoft/spawn-promise)
[![David](https://img.shields.io/david/panosoft/spawn-promise.svg)](https://david-dm.org/panosoft/spawn-promise)
[![npm downloads](https://img.shields.io/npm/dm/spawn-promise.svg)](https://www.npmjs.com/package/spawn-promise)## Installation
```sh
npm install spawn-promise
```## Usage
```js
var spawn = require('spawn-promise');spawn('grep', ['H'], 'Hello').then(function (buffer) {
console.log(buffer.toString()); // Hello
});
```## API
- [`spawn`](#spawn)
---
#### spawn ( command [, args] [, input] )Spawns a child process with the given `command`, writes the `input` value to `stdin`, and returns a `Promise` that is fulfilled with the concatenated `stdout` buffer.
__Arguments__
- `command` - The command to run.
- `args` - An array of arguments to run the `command` with.
- `input` - The value to write to `stdin`.