TopGit
GitHub Repo Review

Async: async npm library for control flow

caolan/async
ATopGit review image for caolan/async
Review by Topgit.dev for caolan/async, with GitHub repository stats and README context.
Quick verdict

Async has survived the shift from callbacks to native promises because it never forced a choice between them — its own README wraps an ES2017 async function inside async.mapLimit with no adapter code. That's the real value: one set of control-flow helpers for both callback and async/await code. It's not a Promise.all replacement for a simple parallel run; it earns its keep once you need mapLimit's concurrency cap instead of hand-rolling one.

Stars
★ 28.1k
Forks
⑂ 2.4k
Language
JavaScript
License
MIT
Topic
Frontend
Updated
Nov 2026
Homepage
GitHub

What is Async?

Async is an npm utility module, installed with npm i async, for working with asynchronous JavaScript in both Node.js and the browser. It bundles an ESM/MJS build that bundlers like Webpack and Rollup pick up automatically, and its functions accept either Node-style callbacks or ES2017 async/await — forEachOf and mapLimit are two examples shown in its own README. A separate pure-ESM package, async-es, is also available.

Core async utilities included

  • ✓forEachOf iterates over an object or array and runs an async callback for each entry, collecting one final error instead of you tracking completion yourself.
  • ✓mapLimit runs an async function over a list with a concurrency cap — the README example caps it at 5 in-flight calls.
  • ✓Functions accept either Node-style error-first callbacks or ES2017 async/await functions, shown side by side in the README's two examples.
  • ✓Ships an ESM/MJS build inside the main async package that Webpack and Rollup pick up automatically, no separate config needed.
  • ✓A pure-ESM package, async-es, is published separately for projects that want an ESM-only dependency.
  • ✓Works directly in the browser as well as Node.js.
How this repository's GitHub stars have grown over time. Source: star-history.com.View the star history ↗

Installing Async via npm

Install with npm i async. That pulls in the main package, which is CommonJS-first but includes an ESM/MJS build that compatible bundlers such as Webpack and Rollup use automatically — no separate flag needed. If you want a pure-ESM dependency instead, install async-es rather than async. Full API documentation lives at caolan.github.io/async, separate from the README; the README doesn't document individual function signatures itself.

Using Async with callbacks and async/await

The README's first example requires async with require("async") and calls async.forEachOf on an object of file paths, reading and JSON-parsing each one inside the callback, then handling a single aggregated error in the final callback once every entry has finished. The second example calls async.mapLimit(urls, 5, ...) and passes it an ES2017 async function that awaits fetch(url) directly — Async runs that async function under the same concurrency-limited control flow, so callback-style and async/await code can sit side by side in the same project.

Strengths

  • ✓Accepts both error-first callbacks and ES2017 async/await functions through the same API, so existing callback code doesn't need a rewrite to start using it.
  • ✓Includes an ESM/MJS build inside the main package that Webpack and Rollup pick up automatically, plus async-es for a pure-ESM setup.
  • ✓MIT licensed, so it drops into commercial and closed-source projects without licensing friction.
  • ✓Runs unmodified in the browser as well as Node.js.

When Async is not the right choice

  • △The README itself doesn't document individual function behavior — you have to visit the separate docs site to look up what each helper actually does.
  • △Two overlapping packages, async and async-es, mean picking the right one for your module system instead of there being one obvious install.
  • △Old enough to still link out to archived v1.5.x docs, so tutorials or answers written against that version won't match the current API.

Alternatives to Async

Native Promises (Promise.all / Promise.allSettled) — no dependency at all if you just need to run a handful of promises in parallel.Bluebird — another promise library with its own concurrency-control helpers, an older alternative from the same callback-to-promise transition era.RxJS — reactive streams instead of one-shot control-flow helpers, a bigger conceptual jump but suited to continuous event data Async doesn't model.p-limit — a small, single-purpose concurrency limiter for promises if all you need is mapLimit's concurrency cap without the rest of Async's function set.

Frequently asked questions

Is Async still maintained in 2024?

The facts here don't include a specific 2024 commit date, but Async ships a current npm package alongside a maintained docs site and a separately archived v1.5.x reference for older versions — the kind of upkeep an abandoned project doesn't bother with.

Can Async be used in both Node.js and the browser?

Yes. Async installs via npm i async for Node.js, and the same package works directly in the browser too. It also bundles an ESM/MJS build that bundlers like Webpack and Rollup pick up automatically.

Is Async MIT licensed and free for commercial use?

Async is released under the MIT license, a permissive license that allows commercial and closed-source use, modification, and redistribution — you just need to keep the original copyright notice intact.

Does Async support ES modules (ESM)?

Yes, Async supports ES modules. The main async package includes an ESM/MJS build that compatible bundlers pick up automatically, and a separate pure-ESM package, async-es, is available if you want an ESM-only dependency.

How does Async compare to using native Promises directly?

Async doesn't replace native Promises — its own README example wraps an ES2017 async function inside async.mapLimit rather than competing with it. Native Promise.all is simpler for a one-off parallel run; Async earns its place once you need a named helper like mapLimit's concurrency cap or forEachOf's object iteration.

What is the difference between async and async-es packages?

The async package is CommonJS-first but bundles an ESM/MJS build that Webpack and Rollup pick up automatically. async-es is a separate, pure-ESM package for projects that want an ESM-only dependency without that auto-detection step. Both come from the same caolan/async project.

The problem it solves

Node's error-first callback style turns iterating over a list or object with async work — like reading several files — into either deep nesting or a hand-rolled counter to track when every callback has fired. Async's forEachOf function, used in its own README example to iterate over a config-file object, replaces that bookkeeping with one call that reports a single final error or none at all.

Best use cases

  • •Reading and parsing several JSON config files into one object without nesting callbacks — the exact pattern in Async's own forEachOf README example.
  • •Fetching a list of URLs with a concurrency cap instead of firing every request at once, the way async.mapLimit(urls, 5, ...) does in the README.
  • •Gradually moving a Node-style callback codebase toward async/await, since Async's functions accept either style.
  • •Bundling for the browser with Webpack or Rollup, where the included ESM/MJS build is picked up automatically.

Who should try it — and who should skip

Teams with existing Node-style callback code that need control-flow helpers — capped-concurrency iteration, for instance — without a full rewrite to promises get the most out of Async. A greenfield project starting from async/await with no callback legacy has less reason to add it: Promise.all and a plain loop cover the simple cases without another dependency.

Related repositories

Source & attribution

Facts, code examples, and license/topic metadata sourced from the caolan/async GitHub repository (https://github.com/caolan/async) and its README.

GitHub data · last synced Aug 15, 2026Reviewed by Henry
← Back to TopGit

Curious whether async is right for you?

Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about async.

GitHub