npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

coproq

v0.1.2

Published

message-passing coprocesses wrapped in OO syntax

Readme

Coprocess

Build Status Coverage Status Coverage Status

Inter-process RPC wrapped in OO syntax.

var coprocess = require('coprocess');

// create a worker process
var coproc = coprocess.fork(function() {
    // worker must load its depencies as if in a separate file
    var Coprocess = require("coprocess").Coprocess;
    new Coprocess().listen({
        echo: function(x, cb) { cb(null, x) },
    });
});

// call the worker, wait for its response
coproc.call('echo', 1234, function(err, reponse) {
    // => err: null, response: 1234
});

Api

coprocess.fork( scriptName | functionBody [,cb] )

Create a new parent / worker object pair. Returns the parent object used to talk to the worker. The worker process launched running the named scriptName or the function functionBody. The callback cb is invoked as soon as the process is running, not after it's initialized. The worker process is killed when the parent process exits.

Script file names are relative to the current working directory, not the source file.

Functions are converted to source and saved to temporary files in the current directory ./node-coprocess-XXXXXX.js and get removed automatically when the parent process calls its process.on('exit') listeners. Worker functions are a convenience, they share no context with the parent function. They must load and initialize all their dependencies as if they were in their own file.

fork throws if unable to create the worker. The optional callback is invoked once the worker process is running.

var coproces = require('coprocess');
var coproc = coprocess.fork("./scripts/test.js");

coproc.close( [cb(err)] )

Terminate the worker process, either by disconnecting from it or killing it.

coproc.call( method [, arg [...]], callback(err, result) )

Invoke the named method with the given argument(s), and wait for the results. The callback will be invoked with the returned result once the call completes.

coproc.emit( event [, value [...]] )

Emit a named event and optional value(s) to the registered event listener. Events are sent back-to-back in order, no response is returned or expected. Note that events and calls are sent and dispatched in order, so receipt of a batch of events can be confirmed with a single call after the batch.

coproc.listen( event, handler(value [, ...]) )

Listen for named events emitted by the remote. The handler function is called with the received arguments whenever the named event is received.

coproc.listen('stats', function(stats) {
    // received another batch of stats, no response expected
})

coproc.listen( methods )

Register handlers for the calls in the methods name-value hash. Each handler function is provided a callback as its last argument, and must call it to signal completion and return an error or a result back to the caller. If completion signaling is not needed, it is faster to emit events.

coproc.listen({
    ping: function(cb) { cb(null) },
    echo: function(value, cb) { cb(null, value) },
})

Message Formats

Call

{ id, name, argc, argv }

Response

{ id, result }

Event

{ name, argc, argv }