Socket
Book a DemoInstallSign in
Socket

@ahmadnassri/spawn-promise

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ahmadnassri/spawn-promise

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

latest
Source
npmnpm
Version
1.2.6
Version published
Weekly downloads
119
138%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

spawn

FAQs

Package last updated on 06 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts