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

Async Logo

Github Actions CI status 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.5                                ...           latest (a year ago)
  • 3.1.0                                ...           next (5 years ago)

92 Versions

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

Copyright 2013 - present © cnpmjs.org | Home |