Skip to content

Latest commit

 

History

History
51 lines (31 loc) · 757 Bytes

README.md

File metadata and controls

51 lines (31 loc) · 757 Bytes

@webpod/exec

A tiny spawn wrapper.

import exec from '@webpod/exec'

const {ls, curl} = exec

const list = ls('-la').trim().split('\n')

const resp = curl('https://medv.io')

Usage

npm i @webpod/exec

Import any binary you would like to call. Use it like a function.

import exec from '@webpod/exec'

const {cat} = exec

const content = cat('README.md')

To get exit code or stderr, use .status or .stderr.

const {git} = exec

console.log(git('pull').status)

To pass options to the spawn, bind to an options object.

const {tee} = exec

tee.call({input: 'Hello, world!'}, 'file.txt')

License

MIT