Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including lighter-spawn with all npm packages installed. Try it out:

var lighterSpawn = require("lighter-spawn")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

lighter-spawn v1.0.0

A lightweight JavaScript child process spawning utility.


Chat Version Downloads Build Coverage Style

The lighter-spawn module is a lightweight child process spawning utility.


From your project directory, install and save as a dependency:

npm install --save lighter-spawn


The API is simply a function which returns a child process.

var spawn = require('lighter-spawn')

// Write file details to the console.
spawn('ls -la')
  .on('out', function (files) {

spawn(command[, options])

Spawn a command, and return a child process object. The command is a string, which can include arguments separated by spaces. If you would like to include a space character inside an argument, use a backslash to escape it.

Event: error

Pass an error object if a process exits with a nonzero exit code.

Event: stderr

Pass a concatenated string of stderr stream data.

Event: stdout

Pass a concatenated string of stdout stream data.

Event: err

Pass an array of lines of stderr stream data.

Event: out

Pass an array of lines of stdout stream data.


For now, please see the tests.

More on lighter-spawn...

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free