axx
v0.2.0
Published
async shell exec, streams, piping
Downloads
5
Readme
axx
- execution of shell commands
- async/await functionality for easy concurrency control
- streaming, proper piping
npm install axx
require("axx")
lean functions
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)