@homeofthings/node-sys
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

npm version Build Workflow Coverage Status DeepScan grade Known Vulnerabilities

PRs Welcome License

@homeofthings/node-sys

This library is mainly intended to be helpful for build and installation tasks. It includes a Fluent API for spawning child processes and many file-system related functions that work and are named similarly to their shell counterparts.

Fluent API for spawning child processes

const out: string[] = [];
await exec('node', '-e', `console.log("hello world")`).setStdOut(out).run();
const script: string[] = [`console.log("hello world")`];
await exec('node').setStdIn(script).run();
const out: string[] = [];
await sh('ls -l *.md').setStdOut(out).run();
const out: string[] = [];
await pipe(sh('ls -l *.md')).to(exec('wc', '-l').setStdOut(out)).run();
// out[0] contains the number of *.md files as string

file-system related functions

file-system related functions that work and are named similarly to their shell counterparts, e.g.: cd, pwd, pushd, popd, dirs, realpath, stat, which, unlink, ln, mktemp, chmod, chown, mkdir, rm, rmdir, touch, cp, mv, rename, ...

await rm('myfile.bak');
await rm(['myfile.bak', 'mytmpdir'], { recursive: true, force: true });
await rm(glob('**/*.bak'));

Package Sidebar

Install

npm i @homeofthings/node-sys

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

63.9 kB

Total Files

34

Last publish

Collaborators

  • gms1