nodejs-sh
This is a Node.js port of the sh Python library, that allows you to call any program as if it were a function:
const ifconfig = let output = await console
Output:
eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: ffff::ffff:ffff:ffff:fff/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0 GB) TX bytes:0 (0 GB)
Installation
npm install nodejs-sh
Quick Reference
Passing Arguments
const ls =
Non-zero Exit Codes
const ls = try await catch exitCode if exitCode === 2 console
Redirection
const fs = const ls = let file = fs
Piping
const ls wc = let output = await
Background Processes
const find = let p = // ... do other things ...await p
TypeScript
; ;