bashx
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

BashX

Execute commands in JS/TS. A warp of child_process.spawn, which allows you process command return values in JS/TS.

I love bash,but am not good at it

Quick start

Install

npm i bashx

Usage

import { x } from 'bashx'

void (async()=>{
    const output = await x`echo 'this is awesome'`
    console.log(output)
    // { code: 0, stdout: 'hello\n', stderr: '' }

    const url = https://example.com/example.json
    const ret = await x`curl -s ${url}`
    console.log(JSON.parse(ret.stdout))
    // { example:'json' }
})().catch(console.log)

Readme

Keywords

Package Sidebar

Install

npm i bashx

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

7.58 kB

Total Files

4

Last publish

Collaborators

  • tony.li