zx wraps child processes with cross-platform helpers, argument escaping, and defaults so you can write shell-oriented scripts in JavaScript or TypeScript instead of bash alone.
Overview
zx is a JavaScript package for writing scripts that run shell commands and use the wider Node.js ecosystem. It targets situations where bash is awkward for more complex logic while raw Node.js child-process APIs need extra boilerplate.
The package supplies cross-platform wrappers around child processes, escapes arguments, and applies sensible defaults so script authors spend less time on plumbing. Documentation and examples live on the project site at google.github.io/zx.
You can write scripts as CommonJS or ECMAScript modules in JavaScript or TypeScript. Supported JavaScript runtimes include Node.js, Bun, Deno, GraalVM Node.js, and Electron. On Unix-like systems scripts expect a shell environment (bash is listed), or PowerShell on Windows.
Compatibility is stated for Linux, macOS, and Windows. Install and setup options are documented under zx/setup, and a lighter zx@lite variant is also referenced.
Key features
- Cross-platform child_process wrappers
- Shell argument escaping
- Sensible process defaults
- CommonJS and ESM module support
- JavaScript and TypeScript scripts
- Linux, macOS, and Windows support
- Node.js, Bun, Deno, and Electron runtimes
- Documented setup and zx@lite variant
Use cases
- Complex shell scripts in JavaScript
- Cross-platform command automation
- Mixing shell commands with npm libraries
- Replacing lengthy bash for multi-step tasks
- Portable scripts across Linux, macOS, and Windows