gitwtfhub

wtf is queue?

henrygd/queue — explained in plain English

Analysis updated 2026-08-10 · repo last pushed 2025-11-20

150TypeScriptAudience · developerComplexity · 2/5QuietSetup · easy

TL;DR

A tiny JavaScript library that limits how many async tasks run at the same time, preventing overwhelm when doing things like fetching data from multiple APIs or uploading files. Under 500 bytes and works everywhere JavaScript runs.

Mindmap

mindmap
  root((repo))
    What it does
      Limits concurrent tasks
      Queues excess tasks
      Collects batch results
    Tech stack
      TypeScript
      JavaScript runtimes
      Cloudflare Workers
    Use cases
      API rate limiting
      Web scraping control
      Batch file uploads
    Strengths
      Under 500 bytes
      Fast benchmarks
      Cross-platform
    Tradeoffs
      AsyncLocalStorage needs variant
    Audience
      App developers
      Vibe coders

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Limit concurrent API requests to avoid hitting rate limits when fetching data from external services.

REASON 2

Control how many files upload at once when sending batches to cloud storage.

REASON 3

Throttle web scraping tasks so you don't overload a target website or get blocked.

REASON 4

Run a batch of async tasks and collect all results together like Promise.all.

What's in the stack?

TypeScriptNode.jsDenoBunCloudflare Workers

How it stacks up

henrygd/queuepolymarket-trading-kit/sports-trading-botnationaldesignstudio/rampart
Stars150150151
LanguageTypeScriptTypeScriptTypeScript
Last pushed2025-11-20
MaintenanceQuiet
Setup difficultyeasyeasy
Complexity2/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 5min

If your app relies on Node's AsyncLocalStorage, you need to import a specific variant of the library instead of the default package.

The license terms are not specified in the README, so check the repository for details on how you can use this library.

Wtf does this do

@henrygd/queue is a tiny JavaScript tool that helps you manage tasks running at the same time. When your app needs to do many things at once, like fetching data from several APIs, this library makes sure it doesn't overwhelm the system by limiting how many tasks can run simultaneously. You create a queue and set a maximum number of concurrent tasks. Then you add your async functions to the queue, and it handles the rest. It only starts as many tasks as your limit allows, holding the rest in line until a slot opens up. You can wait for everything to finish with a single done() call, or use all() to run a batch of tasks and collect their results, similar to how JavaScript's native Promise.all works. This is useful for anyone building apps that interact with external services. For example, if you're scraping data from a website, uploading files to a storage service, or hitting an API that only allows a certain number of requests per second, this library keeps things orderly. It also offers a rate-limiting feature that caps how many tasks can start within a given time window, which is handy when an API enforces strict rate limits. The project's main selling point is its minimal size and speed. The README includes benchmarks across browsers, Node.js, Deno, Bun, and Cloudflare Workers, showing it outperforms similar popular libraries like p-limit and fastq. The base version is under 500 bytes, making it nearly invisible in your app's bundle. It works across all major JavaScript environments. One tradeoff: if your app relies on Node's AsyncLocalStorage feature, you'll need to import a specific variant of the library rather than the default one, since that feature isn't included in the main package to keep it lean.

Yoink these prompts

Prompt 1
Help me set up @henrygd/queue in my Node.js project. I need to limit 100 API calls to 5 at a time and collect all the results. Show me how to use the all() method with a concurrency limit of 5.
Prompt 2
I'm scraping a website that only allows 10 requests per second. Write code using @henrygd/queue with its rate-limiting feature so I can queue 500 page fetches without getting blocked.
Prompt 3
Compare @henrygd/queue with p-limit for my use case. I have a Deno app that uploads files to S3 in batches of 20. Show me how to implement the queue with a concurrency limit of 20 and a done() call to wait for completion.
Prompt 4
I need to use AsyncLocalStorage with @henrygd/queue in my Node.js app. Walk me through importing the correct variant of the library so context propagation works with my queued tasks.

Frequently asked questions

wtf is queue?

A tiny JavaScript library that limits how many async tasks run at the same time, preventing overwhelm when doing things like fetching data from multiple APIs or uploading files. Under 500 bytes and works everywhere JavaScript runs.

What language is queue written in?

Mainly TypeScript. The stack also includes TypeScript, Node.js, Deno.

Is queue actively maintained?

Quiet — no commits in 6-12 months (last push 2025-11-20).

What license does queue use?

The license terms are not specified in the README, so check the repository for details on how you can use this library.

How hard is queue to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is queue for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.