execa
Process execution for Node.js — a better child_process with Promises, streaming, and a clean cross-platform API.
execa
Node.jsProcess execution for Node.js — a better child_process with Promises, streaming, and a clean cross-platform API.
Fit
Bundle (gzip)
32.2 kB
103.5 kB raw
Install size includes transitive dependencies. Bundle size is gzipped browser payload.
Freshness
The Problem
Node's built-in child_process.exec uses callbacks, joins stdout/stderr awkwardly, has inconsistent error handling, and requires manual cross-platform command escaping. Writing shell scripts in Node.js is more painful than it should be.
What It Does
Execa returns Promises, provides separate stdout/stderr streams, throws descriptive errors with the command output when a process fails, and handles cross-platform path separators. The $ tagged template literal gives you a shell-like syntax for composing commands safely.
Installation
npm install execaUsage Example
import { execa, $ } from 'execa';
// Simple command execution
const { stdout } = await execa('git', ['log', '--oneline', '-5']);
console.log(stdout);
// Template literal syntax (safe, no shell injection)
const branch = 'main';
const { stdout: log } = await $`git log --oneline -5 ${branch}`;
// Pipe commands
const result = await execa('cat', ['package.json']).pipeStdout(execa('jq', ['.name']));
console.log(result.stdout);Related packages
Role and attribute based access control (RBAC + ABAC) for Node.js with a fluent, readable API.
bcryptjsNode.jsPure JavaScript bcrypt password hashing — no native dependencies, same API as bcrypt, works anywhere Node.js runs.
bullmqNode.jsPremium message queue and job scheduler for Node.js backed by Redis — reliable background job processing with retries, priorities, and rate limiting.
casbinNode.jsA powerful authorization library that supports RBAC, ABAC, ACL and more via configurable policy models.
dotenvNode.jsLoad environment variables from a `.env` file into `process.env` — the standard way to manage configuration in Node.js apps.