simonplend / using-execa-es-module-in-node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Usage

npm install

Examples

Dynamically importing the execa ES module in a CommonJS module

  • 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

License

MIT

About

License:MIT License