async
Async utilities for node and the browser
Async is a JavaScript utility library with ready-made functions for managing asynchronous operations, running tasks in parallel, in series, with concurrency limits, or with error handling across large batches.
Async is a JavaScript utility library that provides helper functions for working with asynchronous code — code where operations happen out of order, like reading files, fetching data from an API, or querying a database, where you have to wait for each operation to finish before using its result.
JavaScript's asynchronous nature makes it tricky to coordinate multiple operations — for example, running five tasks in parallel and collecting all their results, or processing a list of items one at a time in order. Async provides ready-made functions for these common patterns so you don't have to write the control-flow logic yourself.
The README shows two examples. The first iterates over a set of file paths, reads each file in parallel, and collects the parsed results using async.forEachOf. The second uses async.mapLimit to fetch a list of URLs with a concurrency cap of 5 — meaning only 5 requests run at the same time — and collects the response bodies. Both examples work with Node-style callbacks as well as modern async/await syntax.
The library works in both Node.js server environments and directly in web browsers. It's installable via npm and also available as a pure ES module package called async-es for use with bundlers like Webpack and Rollup.
You would use Async when you need to orchestrate multiple asynchronous operations in JavaScript — running things in series, in parallel, with rate limiting, or with error handling across a batch of tasks — and want a well-tested, compact set of utilities rather than writing that control flow by hand.
Where it fits
- Process a list of files or URLs in parallel with a concurrency cap so you don't overload a server or API.
- Run a series of async operations in strict order, each step using the previous result.
- Batch-process database records with controlled parallelism and collect any errors separately from results.
- Replace deeply nested callbacks or manually chained Promises with a compact, well-tested control-flow function.