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

promise-butler

v1.0.8

Published

A package for managing multiple promises in various ways.

Readme

Promise Butler

The Promise Butler is a versatile JavaScript package designed to manage the execution of promises in various ways. With this package, you can control whether promises are executed sequentially, in batches, or in a pipelined manner. This flexibility allows you to optimize the handling of asynchronous operations in your applications. The promise manager expects an array of callbacks which is expected to return a promise, with which it takes care of the promise execution.

Installation

Bundled File

main.min.js

CDN link (loading bundled file externally)

https://cdn.jsdelivr.net/gh/homeboy445/promiseManager/release/main.min.js

NPM Package

Install it via npm i promise-butler (https://www.npmjs.com/package/promise-butler).

Code Walkthrough

Supported import modes

  • Imports via ESM mode using import/export.
  • Imports via Common JS using require (ideal for NodeJS).
  • The bundled lib file is loaded as UMD which instantiates the package globally.

Below is for the usage via CDN & as a package.

Tip: You can pass { debugMode: true } to getModeObject() as a parameter for enabling logging of the promises execution sequence and their results.

SEQUENTIAL MODE

  • The executor callback will accept no params.

via Bundled file

const promiseArray = [() => Promise.resolve(), () => Promise.resolve()]; // Store the callbacks in the array which would return the promise to be awaited!
const { getModeObject } = promiseButler;
const promiseExecutorCallback = getModeObject().SEQUENTIAL();
await promiseExecutorCallback(promiseArray);

via ES6 imports

import { getModeObject } from "promise-butler";
const promiseArray = [() => Promise.resolve(), () => Promise.resolve()];
const promiseExecutorCallback = getModeObject().SEQUENTIAL();
await promiseExecutorCallback(promiseArray);

BATCHING MODE

  • The execute callback will accept two params, namely:-
    • batchSize (1st positional param): The number of batches the promise array should be divided into.
    • batchWiseCallback (2nd positional param): The callback that is to be executed as soon a batch gets completed.

via Bundled file

const promiseArray = [() => Promise.resolve(), () => Promise.resolve()]; // Store the callbacks in the array which would return the promise to be awaited!
const { getModeObject } = promiseButler;
const promiseExecutorCallback = getModeObject().BATCHED(6 /*batchSize*/, () => console.log("a batch got completed!") /*batchWiseCallback*/);
await promiseExecutorCallback(promiseArray);

via ES6 imports

import { getModeObject } from "promise-butler";
const promiseArray = [() => Promise.resolve(), () => Promise.resolve()];
const promiseExecutorCallback = getModeObject().BATCHED(6 /*batchSize*/, () => console.log("a batch got completed!") /*batchWiseCallback*/);
await promiseExecutorCallback(promiseArray);

PIPELINING MODE

  • The execute callback will accept on param, namely:-
    • slotSize (1st positional param): The number of slots the promises should be allocated to.

via Bundled file

const promiseArray = [() => Promise.resolve(), () => Promise.resolve()]; // Store the callbacks in the array which would return the promise to be awaited!
const { getModeObject } = promiseButler;
const promiseExecutorCallback = getModeObject().PIPELINING(6 /*slotSize*/);
await promiseExecutorCallback(promiseArray);

via ES6 import

import { getModeObject } from "promise-butler";
const promiseArray = [() => Promise.resolve(), () => Promise.resolve()]; // Store the callbacks in the array which would return the promise to be awaited!
const promiseExecutorCallback = getModeObject().PIPELINING(6 /*slotSize*/);
await promiseExecutorCallback(promiseArray);

Modes

FETCH_MODES.SEQUENTIAL: Promises are executed sequentially, one after another.

image

FETCH_MODES.BATCHED: Promises are executed in batches, allowing for concurrent execution within each batch. A batch will consist of any non-zero number and the promises will be awaited batch-wise, for illustration: Promise.all(batch1).then(() => Promise.all(batch2))

image

FETCH_MODES.PIPELINING: Promises will be executed in a slot-wise manner i.e. promises will be assigned to certain slots and the rest of the promises will be executed as soon as the slots get free - leading to proper resource utilization. This will ultimately also lead to promises being executed in a PIPELINED fashion.

image

Issues

  • If any issue is there in any of the modes, please feel free to report it by creating a ticket.