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

ccq

v0.1.0

Published

Javascript queues with concurrency control!

Readme

ccq

Build Status

Javascript queues with concurrency control!

You can think of a controlled-concurrency queue as an array of tasks with a positive concurrency n, which means that at any given time, at most n of the queued tasks are being executed concurrently, while the rest are either waiting to commence execution, or have finished executing.

The Queue API

var queue = new Queue(n);

This constructor function creates a new queue with a concurrency of n. You may add as many tasks to the queue as needed, but no more than n of these tasks are allowed to execute concurrently at any given time. If no n is passed, we get a queue with unbounded concurrency.

var Queue = require("queue").Queue;

// creates a new queue with a concurrency of 5
var q = new Queue(5);

queue.add(task[, taskArgs...]);

The add() method adds a new task to the queue. At this point, if the queue concurrency hasn't been reached, then task is invoked immediately with the arguments taskArgs. Otherwise, task is added to a list of tasks already waiting to be executed. Therefore, once a task has been added to the queue, it may exist in one of 3 mutually exclusive states at any given time: ACTIVE, WAITING or COMPLETED.

Each task is also passed a callback(error, results) function as its last argument. The task must call this function once it has finished executing, to inform the queue of its completion. In case of a successfull completion, the error argument passed to the callback must be null, and the results argument must contain a single value containing the result of the function execution.

// adds a new `uploadFile` task to the queue
queue.add(uploadFile, [files[i]], onUpload);

queue.await(callback);

Finally, the await() method can be used to tell the queue that no further tasks will be added to it, and that the callback function must be invoked once all the tasks have finished executing. This callback will be invoked with a list (results) of exceptions or return values from every task. The elements in results will match the order in which their corresponding tasks were added to the queue. For exceptions, the isError flag of the result element will be set. Result data (exception or return value) is available in result.data.

// the callback passed to `.await()` will be invoked once all the tasks have finished
queue.await(function(results) {
    var failedUploads = results.filter(function (result) { return result.isError; });
    console.log('Finished uploading. ' + results.length - failedUploads.length + ' successful, ' + failedUploads.length + ' failed.');
});