using-execa-es-module-in-node
Example scripts using the execa library.
Article
The code in this repository was written to accompany the article Running commands with execa in Node.js.
Requirements
- Node.js >= v14.13.1
Usage
npm install
Examples
execa
ES module in a CommonJS module
Dynamically importing the - Code
- Run:
node examples/commonjs-usage.cjs
Running a command with execa
- Code
- Run:
node examples/run-1.js
Capturing stderr
- Code
- Run:
node examples/run-2.js
Error handling
- Code
- Run:
node examples/run-3.js
Cancelling a child process
- Code
- Run:
node examples/run-4.js
Piping output from a child process
- Code
- Run:
node examples/run-5.js
Redirecting output to a file
- Code
- Example:
node examples/run-6.js