@ahmadnassri/spawn-promise

1.2.6 • Public • Published

Spawn Promise

Child Process Spawn as a Promise, with simple in/out piping

license release semantic

Install

npm install @ahmadnassri/spawn-promise

API

spawn (command [, args] [, options] [, input])

identical to [child_process.spawn][node-spawn] in every way, except:

  • writes the input value to stdin,
  • on success returns a Promise that is fulfilled with a simple object containing both stdout & stderr buffers.
  • on failure returns a Promise rejected with a SpawnError error object containing both stdout & stderr buffers.

Usage

const spawn = require('@ahmadnassri/spawn-promise')

const options = {
  env: process.env
}

// success
spawn('grep', ['f'], options, 'foo')
  .then(streams => console.log(streams.stdout))

Author: Ahmad Nassri • Twitter: @AhmadNassri

Readme

Keywords

Package Sidebar

Install

npm i @ahmadnassri/spawn-promise

Weekly Downloads

4

Version

1.2.6

License

MIT

Unpacked Size

5.41 kB

Total Files

5

Last publish

Collaborators

  • ahmadnassri