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

@ferrow/async-batch-processor

v1.0.0

Published

Sliding-window async pool with per-item retry, order preservation, and helpers

Readme

async-batch-processor

CI

Sliding-window async pool. Keeps exactly N items in flight, preserves result order, supports per-item retry with exponential backoff, abort signaling, and progress callbacks.

Quickstart

import { AsyncBatchProcessor } from 'async-batch-processor';

const processor = new AsyncBatchProcessor();

const items = Array(20).fill(0).map((_, i) => i);
const results = await processor.process(
  items,
  async (item) => {
    const res = await fetch(`https://api.example.com/item/${item}`);
    return res.json();
  },
  {
    concurrency: 3,
    retry: 2,
    onProgress: (current, total) => console.log(`${current}/${total}`)
  }
);

// results[0].item === 0, results[0].result === { ... }
// results[0].retries === 0 (or 1/2 if retried)

API

process(items, worker, options?)

Run worker on items with concurrency control.

Options:

  • concurrency (default 1) — max in-flight count
  • retry (default 0) — max retry attempts per item
  • onProgress — callback(current, total)
  • signal — abort-like { aborted: boolean }

Returns: ItemResult[] preserving input order

interface ItemResult<T, R> {
  item: T;
  result?: R;
  error?: Error;
  retries: number;  // attempts made
}

mapLimit(items, concurrency, worker)

Shorthand for process() returning results array. Throws on error.

const results = await processor.mapLimit(items, 3, worker);

forEachLimit(items, concurrency, worker)

Shorthand for side-effect processing.

await processor.forEachLimit(items, 3, async (item) => {
  await save(item);
});

Scope & Limits

  • Sliding window — not chunk barriers; exactly N in flight at steady state
  • No persistence — in-memory; failures not logged
  • Order preserved — results array index matches items array
  • Retry is exponential backoff — 10ms * 2^attempt
  • AbortSignal-like only — not full AbortController
  • No timeout per item — use Promise.race or external timeout

License

MIT


Sponsored by Ferrow


Part of the ferrow-toolkit collection · Sponsored by Ferrow