
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
co-child-process
Advanced tools
Spawn a child process using co. Kind of like exec, except you can write to stdin and there aren't as many options like timeout or encoding.
Minify a Javascript in a child process. Useful when the JS files are large and you don't want uglifyjs blocking the event loop.
var fs = require('fs')
var co = require('co')
var spawn = require('co-child-process')
// resolve the location of the binary
var uglifyjs = require.resolve('uglify-js/bin/uglifyjs')
co(function* () {
var stream = fs.createReadStream(__filename)
var minified = yield spawn(uglifyjs, [
'-' // tells uglifyjs to check for `stdin`
]).pump(stream) // since you can't pipe into the generator
})()
A wrapper around child_process.spawn. The arguments are simply passed and are not touched.
Output is always a string, for now.
Pump a stream into the child process' stdin. Kind of like .pipe() but in the opposite direction.
Must be called on the same tick.
Write a buffer or string body to stdin.
var out = yield spawn(uglifyjs, ['-']).end('var a = 1;')
Must be called on the same tick.
FAQs
easily spawn a child process with co
We found that co-child-process demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.