You need to sign in or sign up before continuing.
Name Last Update
..
dist Loading commit data...
internal Loading commit data...
CHANGELOG.md Loading commit data...
LICENSE Loading commit data...
README.md Loading commit data...
all.js Loading commit data...
allLimit.js Loading commit data...
allSeries.js Loading commit data...
any.js Loading commit data...
anyLimit.js Loading commit data...
anySeries.js Loading commit data...
apply.js Loading commit data...
applyEach.js Loading commit data...
applyEachSeries.js Loading commit data...
asyncify.js Loading commit data...
auto.js Loading commit data...
autoInject.js Loading commit data...
bower.json Loading commit data...
cargo.js Loading commit data...
cargoQueue.js Loading commit data...
compose.js Loading commit data...
concat.js Loading commit data...
concatLimit.js Loading commit data...
concatSeries.js Loading commit data...
constant.js Loading commit data...
detect.js Loading commit data...
detectLimit.js Loading commit data...
detectSeries.js Loading commit data...
dir.js Loading commit data...
doDuring.js Loading commit data...
doUntil.js Loading commit data...
doWhilst.js Loading commit data...
during.js Loading commit data...
each.js Loading commit data...
eachLimit.js Loading commit data...
eachOf.js Loading commit data...
eachOfLimit.js Loading commit data...
eachOfSeries.js Loading commit data...
eachSeries.js Loading commit data...
ensureAsync.js Loading commit data...
every.js Loading commit data...
everyLimit.js Loading commit data...
everySeries.js Loading commit data...
filter.js Loading commit data...
filterLimit.js Loading commit data...
filterSeries.js Loading commit data...
find.js Loading commit data...
findLimit.js Loading commit data...
findSeries.js Loading commit data...
flatMap.js Loading commit data...
flatMapLimit.js Loading commit data...
flatMapSeries.js Loading commit data...
foldl.js Loading commit data...
foldr.js Loading commit data...
forEach.js Loading commit data...
forEachLimit.js Loading commit data...
forEachOf.js Loading commit data...
forEachOfLimit.js Loading commit data...
forEachOfSeries.js Loading commit data...
forEachSeries.js Loading commit data...
forever.js Loading commit data...
groupBy.js Loading commit data...
groupByLimit.js Loading commit data...
groupBySeries.js Loading commit data...
index.js Loading commit data...
inject.js Loading commit data...
log.js Loading commit data...
map.js Loading commit data...
mapLimit.js Loading commit data...
mapSeries.js Loading commit data...
mapValues.js Loading commit data...
mapValuesLimit.js Loading commit data...
mapValuesSeries.js Loading commit data...
memoize.js Loading commit data...
nextTick.js Loading commit data...
package.json Loading commit data...
parallel.js Loading commit data...
parallelLimit.js Loading commit data...
priorityQueue.js Loading commit data...
queue.js Loading commit data...
race.js Loading commit data...
reduce.js Loading commit data...
reduceRight.js Loading commit data...
reflect.js Loading commit data...
reflectAll.js Loading commit data...
reject.js Loading commit data...
rejectLimit.js Loading commit data...
rejectSeries.js Loading commit data...
retry.js Loading commit data...
retryable.js Loading commit data...
select.js Loading commit data...
selectLimit.js Loading commit data...
selectSeries.js Loading commit data...
seq.js Loading commit data...
series.js Loading commit data...
setImmediate.js Loading commit data...
some.js Loading commit data...
someLimit.js Loading commit data...
someSeries.js Loading commit data...
sortBy.js Loading commit data...
timeout.js Loading commit data...
times.js Loading commit data...
timesLimit.js Loading commit data...
timesSeries.js Loading commit data...
transform.js Loading commit data...
tryEach.js Loading commit data...
unmemoize.js Loading commit data...
until.js Loading commit data...
waterfall.js Loading commit data...
whilst.js Loading commit data...
wrapSync.js Loading commit data...

Async Logo

Build Status via Travis CI Build Status via Azure Pipelines NPM version Coverage Status Join the chat at https://gitter.im/caolan/async jsDelivr Hits

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. A 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)
})