axx

0.2.0 • Public • Published

axx

  • execution of shell commands
  • async/await functionality for easy concurrency control
  • streaming, proper piping

npm install axx

require("axx")

lean functions

  • axx — run shell command
  • raxx — read from file
  • waxx — write to file
  • caxx — log to stdout (the console)

memory-hog functions

  • maxx — same as axx, but returns the full stdout result
  • mraxx — same as raxx, but returns the whole file to result

examples

 
const {axx, raxx, waxx} = require("axx")
 
const n = `$(npm bin)` // "node_modules/.bin"
 
async function build() {
 
    // minify a script
    await
    raxx(`myscript.js`,
        axx(`${n}/uglifyjs --compress --mangle`,
            waxx(`myscript.min.js`)
        )
    )
 
    // run a few concurrent operations, wait for them all to complete
    await Promise.all([
        axx(`${n}/tsc`),
        axx(`cat src/a src/b`, waxx(`dist/c`)),
        axx(`${n}/node-sass --source-map true src/s.scss dist/s.css`)
    ])
 
    console.log("✔ done build")
}
 

some more contrived examples

 
// log the package.json to the console just so i can see it
await raxx(`package.json`, caxx())
 
// alternative (memory-hog) way to log to the console
const text = await mraxx(`LICENSE.txt`)
console.log(text)
 

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.0
    1
    • latest

Version History

Package Sidebar

Install

npm i axx

Weekly Downloads

8

Version

0.2.0

License

ISC

Unpacked Size

22.7 kB

Total Files

38

Last publish

Collaborators

  • chasemoskal