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

concurrency.js

v0.0.5

Published

npm module to work with concurrency - worker threads and worker processes (currrently only fork method) easily using simple functions and script files

Downloads

119

Readme

concurrency.js

npm module to work with concurrency - worker threads and worker processes easily using simple functions and script files

Installation

npm install concurrency.js --save

Find the demos in the demos folder. Works but is experimental. Use at your own risk. Please provide as much feedbacks as possible

Run tasks in async mode using promises as simple as below:

// This repository's root folder
const { runPromiseTasks } = require("concurrency.js") // require("../tasks.async.js");

// --- Execution Plan using String Names ---
const executionPlan = [
    "taskone",                       // Index 0
    ["tasktwo", "taskthree", "taskone"], // Index 1 (Parallel)
    "taskfour",                      // Index 2
    "taskthree",                     // Index 3
    "taskone"                        // Index 4
];

const resultContext = {};
// This repository's demos folder
const taskLibraryPath = './demos/libmap.js';

runPromiseTasks(executionPlan, resultContext, taskLibraryPath)
    .then((finalContext) => {
        console.log("\n--- Promises Based Final Accumulated Results Context ---");
        console.log(JSON.stringify(finalContext, null, 2));
    })
    .catch((err) => {
        console.error("Task execution failed:", err);
    });

Run tasks in a mix of nodejs code and run threaded code of nodejs execution plan

// This repository's root folder
const {runThreadedTasks, createWorkerPool} = require("concurrency.js")  // require("../tasks.thread")

// --- Execution Plan ---
const executionPlan = [
  "taskone",
  ["tasktwo", "taskthree", "taskone"], // Threaded parallel
  "taskfour",
  "taskthree",
  "taskone"
];

const resultContext = { results: [] };
// This repository's demos folder
const taskFileName = './demos/libmap.js'; 

// The file to be imported dynamically
//      from concurrent-tasks\worker.js

runThreadedTasks(executionPlan, resultContext, taskFileName)
  .then(final => {
    console.log("\n--- Threads Based Final Accumulated Results ---");
    console.log(JSON.stringify(final, null, 2));
    process.exit(0);
  })
  .catch(err => {
    console.error("Fatal Error:", err);
    process.exit(1);
  });

Run tasks in a mix of nodejs code and run process worker code of nodejs execution plan

// This repository's root folder
const { runProcessTasks, runInProcess }  = require("concurrency.js")  // require("../tasks.process");

// --- Execution Plan ---
const executionPlan = [
  "taskone",                       // Index 0
  ["tasktwo", "taskthree", "taskone"], // Index 1 (Parallel Processes)
  "taskfour",                      // Index 2
  "taskthree",                     // Index 3
  "taskone"                        // Index 4
];

const resultContext = { results: [] };
const taskLibraryPath = './demos/libmap.js';
// This repository's demos folder

runProcessTasks(executionPlan, resultContext, taskLibraryPath)
  .then(final => {
    console.log("\n--- Final Accumulated Results (Process-Based) ---");
    console.log(JSON.stringify(final, null, 2));
  })
  .catch(err => {
    console.error("Execution Error:", err);
  });

Contributions

Contributions, Feature Improvements, Bugs, and Issues are invited. raising an issue

TODO

Todo

License

MIT License