async shell exec, streams, piping
npm install axx- execution of shell commands
- async/await functionality for easy concurrency control
- streaming, proper piping
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
``javascript
const {axx, raxx, waxx} = require("axx")
const n = $(npm bin) // "node_modules/.bin"
async function build() {
// minify a script
await
raxx(myscript.js,${n}/uglifyjs --compress --mangle
axx(,myscript.min.js
waxx()
)
)
// run a few concurrent operations, wait for them all to complete
await Promise.all([
axx(${n}/tsc),cat src/a src/b
axx(, waxx(dist/c)),${n}/node-sass --source-map true src/s.scss dist/s.css
axx()
])
console.log("✔ done build")
}
`
some more contrived examples
`javascript
// 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)
``