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

minimalist-queue

v1.0.4

Published

A node minimalist queue module

Readme

minimalist-queue

Version Build Status Coverage Status

A node minimalist queue module without dependencies

Allow you to queue CPU/memory intensive async (or sync) tasks.

Install

$ npm install minimalist-queue

Usage

Here is simple example of using queue.

const { Queue, QueueEvents } = require("minimalist-queue");

const asyncTask = () => new Promise((resolve) => setTimeout(() => resolve("asyncTask"), 100));

const queue = new Queue();

queue.on(QueueEvents.TASK_DONE, (data) => {
    console.log(`Result : ${data.result}`);
});

queue.addTask(asyncTask);

queue.start();

DOCUMENTATION

Queue

Class used to managing tasks

options

concurrency

Type: number Default: 5

Number of simultaneous tasks.

timeout

Type: number Default: 120000

Time before task was forced to shutdown.

autoStart

Type: boolean Default: false

Queue will start automatically when a new task is added to the queue.

constructor(options?)

Create a new instance of a queue with given options, or use defaults if no options are given.

.getTasks()

Type: Function

Return the list of added tasks.

.addTask(task<function>)

Type: Function

Create a new task with the given task function and add it to the queue

.removeTask(task<QueueTask>)

Type: Function

Remove a given task of the queue.

.start()

Type: Function

Start the queue.

.clear()

Type: Function

Clear the queue.

QueueEvents

Class that containing all Queue events as static properties

TASK_START

Triggered when a task start

TASK_DONE

Triggered when a task is done

TASK_FAILED

Triggered when a task failed to execute or encounter the queue timeout

START

Triggered when queue is starting

DONE

Triggered when queue is done

Advanced example

Here is a full example or minimalist-queue usage with sync / async (await included) and failed tasks

const { Queue, QueueEvents } = require("minimalist-queue");

const syncTask = () => "syncTask";

const asyncTask = () => new Promise((resolve) => setTimeout(() => resolve("asyncTask"), 100));

const awaitAsyncTask = async () => {
    const promise = new Promise((resolve) => setTimeout(() => resolve("awaitAsyncTask"), 200));
    return await promise;
};

const syncTaskFailed = () => _syncTaskFailed;

const asyncTaskFailed = () =>
    new Promise((resolve, reject) =>
        setTimeout(() => {
            try {
                resolve(_asyncTaskFailed);
            } catch (error) {
                reject(error);
            }
        }, 100)
    );

const awaitAsyncTaskFailed = async () => {
    const promise = new Promise((resolve, reject) => {
        setTimeout(() => {
            try {
                resolve(_awaitAsyncTaskFailed);
            } catch (error) {
                reject(error);
            }
        }, 200);
    });
    return await promise;
};

const queue = new Queue();

queue.on(QueueEvents.START, () => {
    console.log("\n+-------------------");
    console.log("Queue started");
    console.log("-------------------+");
});

queue.on(QueueEvents.DONE, () => {
    console.log("\n=-------------------");
    console.log("Queue done");
    console.log("-------------------=");
});

queue.on(QueueEvents.TASK_DONE, (data) => {
    console.log(`\x1b[33mTask done ! Result : ${data.result} in ${data.completionTime} ms\x1b[0m`);
});

queue.on(QueueEvents.TASK_FAILED, (data) => {
    console.log("\nxxxxxxxxxxxxxxxxxxxx");
    console.log(`\x1b[31mTask failed ! Error : ${data.result.message}\x1b[0m`);
    console.log("xxxxxxxxxxxxxxxxxxxx\n");
});

queue.on(QueueEvents.TASK_START, (data) => {
    console.log("\nTask start ! task details :", data.result, "\n");
});

queue.addTask(awaitAsyncTask);
queue.addTask(syncTask);
queue.addTask(asyncTask);

queue.addTask(awaitAsyncTaskFailed);
queue.addTask(syncTaskFailed);
queue.addTask(asyncTaskFailed);

queue.start();