@webpod/exec
v1.0.1
Published
A tiny spawn wrapper
Downloads
5
Readme
@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