async
Higher-order functions and common patterns for asynchronous code
Last updated 3 years ago by aearly .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install async 
SYNC missed versions from official npm registry.

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

Current Tags

  • 3.2.0                                ...           latest (3 months ago)
  • 3.1.0                                ...           next (a year ago)

86 Versions

  • 3.2.0                                ...           3 months ago
  • 3.1.1                                ...           4 months ago
  • 2.6.3                                ...           a year ago
  • 3.1.0                                ...           a year ago
  • 3.0.1                                ...           a year ago
  • 3.0.0                                ...           a year ago
  • 2.6.2                                ...           a year ago
  • 3.0.1-0 [deprecated]           ...           2 years ago
  • 2.6.1                                ...           2 years ago
  • 2.6.0                                ...           3 years ago
  • 2.5.0                                ...           3 years ago
  • 2.4.1                                ...           3 years ago
  • 2.4.0                                ...           3 years ago
  • 2.3.0                                ...           3 years ago
  • 2.2.0                                ...           3 years ago
  • 2.1.5                                ...           3 years ago
  • 2.1.4                                ...           4 years ago
  • 2.1.2                                ...           4 years ago
  • 2.1.1                                ...           4 years ago
  • 2.1.0                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 2.0.0-rc.6                                ...           4 years ago
  • 2.0.0-rc.5                                ...           4 years ago
  • 2.0.0-rc.4                                ...           4 years ago
  • 2.0.0-rc.3                                ...           4 years ago
  • 2.0.0-rc.2                                ...           4 years ago
  • 2.0.0-rc.1                                ...           4 years ago
  • 2.0.0-alpha.0                                ...           4 years ago
  • 1.5.2                                ...           4 years ago
  • 1.5.1                                ...           4 years ago
  • 1.5.0                                ...           5 years ago
  • 1.4.2                                ...           5 years ago
  • 1.4.1                                ...           5 years ago
  • 1.4.0                                ...           5 years ago
  • 1.3.0                                ...           5 years ago
  • 1.2.1                                ...           5 years ago
  • 1.1.1                                ...           5 years ago
  • 1.2.0                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
  • 0.9.2                                ...           5 years ago
  • 0.9.0                                ...           6 years ago
  • 0.8.0                                ...           6 years ago
  • 0.7.0                                ...           6 years ago
  • 0.6.2                                ...           6 years ago
  • 0.6.1                                ...           6 years ago
  • 0.6.0                                ...           6 years ago
  • 0.5.0                                ...           6 years ago
  • 0.4.1                                ...           6 years ago
  • 0.4.0                                ...           6 years ago
  • 0.3.0                                ...           6 years ago
  • 0.2.10                                ...           6 years ago
  • 0.2.9                                ...           7 years ago
  • 0.2.8                                ...           7 years ago
  • 0.2.7                                ...           7 years ago
  • 0.2.6                                ...           7 years ago
  • 0.2.5                                ...           7 years ago
  • 0.2.4                                ...           7 years ago
  • 0.2.3                                ...           7 years ago
  • 0.2.2                                ...           7 years ago
  • 0.2.1                                ...           7 years ago
  • 0.2.0                                ...           7 years ago
  • 0.1.22                                ...           8 years ago
  • 0.1.21                                ...           8 years ago
  • 0.1.20                                ...           8 years ago
  • 0.1.19                                ...           8 years ago
  • 0.1.18                                ...           8 years ago
  • 0.1.17                                ...           8 years ago
  • 0.1.16                                ...           8 years ago
  • 0.1.15                                ...           9 years ago
  • 0.1.14                                ...           9 years ago
  • 0.1.13                                ...           9 years ago
  • 0.1.12                                ...           9 years ago
  • 0.1.11                                ...           9 years ago
  • 0.1.10                                ...           9 years ago
  • 0.1.9                                ...           9 years ago
  • 0.1.8                                ...           9 years ago
  • 0.1.2                                ...           9 years ago
  • 0.1.7                                ...           9 years ago
  • 0.1.6                                ...           9 years ago
  • 0.1.5                                ...           9 years ago
  • 0.1.4                                ...           9 years ago
  • 0.1.3                                ...           9 years ago
  • 0.1.1                                ...           9 years ago
  • 0.1.0                                ...           9 years ago
Downloads
Today 49,675
This Week 301,970
This Month 301,970
Last Day 64,036
Last Week 357,335
Last Month 1,419,015
Dependencies (1)
Dev Dependencies (38)
Dependents (29532)