spawnFunction
Spawn a child_process and run a function in it. Get the function's results on your main process using a stream or callback
Install
npm install spawn-function
Usage
Callback mode
- isolatedFunction: Function to be executed on the spawned process. Must be a self-contained/isolated function
- options: Object to be passed to child_process.spawn()
- callback(error, data): Callback to be called when isoldatedFunction is done
Example
let spawnFunction =
Stream mode
let stream =
- stream: Returned stream
- isolatedFunction: Function to be executed on the spawned process. Must be a self-contained/isolated function.
- options: Object to be passed to child_process.spawn()
Example
let stream = let chunk = stream stream stream