Package Exports
- child-process-utilities
- child-process-utilities/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (child-process-utilities) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
child-process-utilities
Installation
yarn add child-process-utilitiesUsage
Wait for a process to finish
import { spawn } from "child-process-utilities";
export default async function () {
await spawn("npx", ["ts-node", "src"]).wait();
}Get the output of a process
String
import { spawn } from "child-process-utilities";
export default async function () {
const { stdout, stderr } = await spawn("npx", ["ts-node", "src"]).output();
console.log(stdout.utf8()); // Returns a string
console.error(stderr.utf8()); // Returns a string
}Uint8Array
import { spawn } from "child-process-utilities";
export default async function () {
const { stdout, stderr } = await spawn("npx", ["ts-node", "src"]).output();
console.log(stdout.raw()); // Returns an Uint8Array
console.error(stderr.raw()); // Returns an Uint8Array
}JSON
import { spawn } from "child-process-utilities";
export default async function () {
const { stdout, stderr } = await spawn("npx", ["ts-node", "src"]).output();
console.log(stdout.json()); // Parses the stdout as JSON
console.error(stderr.json()); // Parses the stderr as JSON
}