HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
caolan
async
JavaScript2010–2020
caolan / async

async

Async utilities for node and the browser

76Distinct people
81Mentions
2Explicit recommenders
28.1KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Async utilities for node and the browser

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

It's a little tiring to see some of the same old fallacies about Node repeated ad infinitum in this thread. I suspect a lot of the complaints stem from poor development…

yid used a recommendation phrase. 2 indexed comments match. This is a phrase match, not a verdict.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 1:49:46 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year81 dated mentions

Observed mentions: 2010-10-12 01:05:50 UTC to 2020-01-21 18:21:07 UTC.

051015202010-01-01 00:00:00 UTC to 2011-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20102011-01-01 00:00:00 UTC to 2012-01-01 00:00:00 UTC (exclusive): 18 mentions; 1 submissions, 17 comments2012-01-01 00:00:00 UTC to 2013-01-01 00:00:00 UTC (exclusive): 21 mentions; 0 submissions, 21 comments2013-01-01 00:00:00 UTC to 2014-01-01 00:00:00 UTC (exclusive): 18 mentions; 0 submissions, 18 comments2014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 10 mentions; 0 submissions, 10 comments2015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments20152016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 6 mentions; 2 submissions, 4 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2020

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20102010-01-01 00:00:00 UTC2011-01-01 00:00:00 UTC101
20112011-01-01 00:00:00 UTC2012-01-01 00:00:00 UTC18117
20122012-01-01 00:00:00 UTC2013-01-01 00:00:00 UTC21021
20132013-01-01 00:00:00 UTC2014-01-01 00:00:00 UTC18018
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC10010
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC303
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC624
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC202
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC101
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC000
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC101

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
Async is a utility module which provides straight-forward, powerful functions for working with asynchronous JavaScript. Although originally designed for use with Node.js and installable via npm i async, it can also be used directly in the browser. An ESM/MJS version is included in the main async package that should automatically be used with compatible bundlers such as Webpack and Rollup. A pure ESM version of Async is available as async-es. For Documentation, visit https://caolan.github.io/async/ For Async v1.5.x documentation, go HERE // for use with Node-style callbacks... var async = require("async"); var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"}; var configs = {}; async.forEachOf(obj, (value, key, callback) => { fs.readFile(__dirname + value, "utf8", (err, data) => { if (err) return callback(err); try { configs[key] = JSON.parse(data); } catch (e) { return callback(e); } callback(); }); }, err => { if (err) console.error(err.message); // configs is now a map of JSON data doSomethingWith(configs); }); var async = require("async"); // ...or ES2017 async functions async.mapLimit(urls, 5, async function(url) { const response = await fetch(url) return response.body }, (err, results) => { if (err) throw err // results is now an array of the response bodies console.log(results) })
Read the full README on GitHub

What Hacker News says

81 sources
I find the `async` library excels at this: var fs = require('fs'); var async = require('async'); async.waterfall([ (cb) => fs.readFile('foo.txt', cb), (data, cb) => my_function(data, cb), (result, cb) => myDb.lookup(result, cb), ], (err, finalResult) { if (err) { console.error(err); } else { console.log(finalResult); } }); There are all sorts of helpful async primitives in there. I don't write Javascript without it! Here is a link to the documentation: https://github.com/caolan/async
In Faking Co-Routines, or Why Callback Hell Is Over (2014)
Promises are just as easy to parallelize as callbacks, though. Easier, IMO, since you can pull their values more than once. Here's an example of some code I had to write to query a somewhat nasty Web API: async function apiCall(method, path, qs, body) { ... } async function getPaginated(path, qs, extractionFn) { let data = []; let pagePromises = [ apiCall('GET', path, Object.assign({ }, qs, { page: 1 })) ]; let firstPage = await pagePromises[0]; for (let page = 2; page <= firstPage.pagination.page_count; ++page) { pagePromises.push( apiCall('GET', path, Object.assign({ }, qs, { page })) ); } let pages = await Promise.all(pagePromises); for (let page of pages) { let extracted = await extractionFn(page, qs); data = data.co
Read the rest
ncat(extracted); } return data; } Note that because of how promises work I didn't have to special case the storage of the first page (which needs to be fetched first to get the number of pages); I can just wait on it again and get the promise-cached answer. I don't know what async.js code to do that would look like but I doubt it'd be as succinct. async functions magically return promises. You don't have to just await them, you can choose to do whatever you want with the resulting promises. And promises, being actual values and not just functions called at the right time, are much easier to compose. Anyway, if you like the async.auto functionality, it wouldn't be very hard to write a Promise.auto that would let you do (compare to the async.auto example at https://github.com/caolan/async#auto): let results = await Promise.auto({ get_data: async function(){ console.log('in get_data'); // async code to get some data return [ 'data', 'converted to array' ]; }, make_folder: async function(){ console.log('in make_folder'); // async code to create a directory to store a file in // this is run at the same time as getting the data return 'folder'; }, write_file: ['get_data', 'make_folder', async function(results){ console.log('in write_file', JSON.stringify(results)); // once there is some data and the directory exists, // write the data to a file in the directory return 'filename'; }], email_link: ['write_file', async function({write_file}){ console.log('in email_link', JSON.stringify(results)); // once the file is written let's email a link to it... // results.write_file contains the filename returned by write_file. return {'file':write_file, 'email':'user@example.com'}; }] }); console.log('results = ', results); ...which is the same functionality except you don't have explicit callbacks running around everywhere. For that example, though, I'd rather just write a: let [ data, folder ] = await Promise.all([get_data, make_folder]); and do the rest as simple "sequential-ish" code. I've written code with async.js, and it's nice. I vastly prefer Promises. The only thing I still use from async.js is the queueing stuff, and I wrap that up with Promises.
In Node.js: Cluster vs. Async
Actually would argue that Promises are less composable since you're forced to use whatever control flow paradigm the Promise library has provided or add another library to handle control flow. By utilizing callbacks, you are free to use Async.js[0] or Step.js[1] to solve the problem you described. These libraries are great since they give you control over parallel vs series execution of the pre-requisite functions as well as solving more complex control-flow problems such as throttling, etc[2] (See link for more examples). [0] https://github.com/caolan/async [1] https://github.com/creationix/step [2] https://github.com/caolan/async#control-flow edit: Yes, you can also use similar control-flow libraries with Promises (that follow the specification) to achieve similar results but then the argument for using promises for the sake of control-
Read the rest
flow breaks down.
In Rdb – a Node.js ORM with transactions, persistence ignorance and promises
It's honestly not as much of an issue as it's often made out to be. There are a ton of ways to manage asynchronous code out there including but not limited to all the various promise libraries such as when.js(https://github.com/cujojs/when), q (https://github.com/kriskowal/q), and bluebird (https://github.com/petkaantonov/bluebird). Not to mention the Async library (https://github.com/caolan/async) which is full of tools to help manage it. As for blocking, it's something you deal with. Realistically speaking if you're doing CPU intensive tasks then Node is definitely the wrong solution. However, if you're doing tasks that are IO oriented then Node is fantastic.
In Yahoo Mail moving to React
yid·May 13, 2014Recommendation phrase
It's a little tiring to see some of the same old fallacies about Node repeated ad infinitum in this thread. I suspect a lot of the complaints stem from poor development practices or not understanding norms in JS. JS isn't without its flaws, but can we at least put a few fallacies to rest: > callback hell There's no reason to be in callback hell if you use an asynchronous control flow library and stick to the standard style of function signatures. I love @caolan's async [1]. In particular, there's a control flow pattern called `auto` that really (IMO) demonstrates some of the power of async programming: it's a full dependency graph resolver [2]. > single-threaded There's the cluster module, but nevermind that -- you can always just use the child_process library [3] to access spawn() and fork(). Remember those? Processes are a more nautral
Read the rest
match for distributed computing than threads anyway. > lack of strict typing Strict typing won't make you a better developer, and you can enforce some degree of type correctness with Closure compiler annotations. [1] https://github.com/caolan/async [2] https://github.com/caolan/async#auto [3] http://nodejs.org/api/child_process.html
In Why Node.js is becoming the go-to technology in the Enterprise

Showing the 15 most recent of 81 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.