async
Higher-order functions and common patterns for asynchronous code
Last updated 14 years ago .
MIT · Repository · Original npm · Tarball · package.json
$ npm 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.6                                ...           latest (3 months ago)
  • 3.1.0                                ...           next (5 years ago)

93 Versions

  • 3.2.6                                ...           3 months ago
  • 3.2.5                                ...           a year ago
  • 3.2.4                                ...           2 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                                ...           5 years ago
  • 3.0.0                                ...           5 years ago
  • 2.6.2                                ...           6 years ago
  • 3.0.1-0 [deprecated]           ...           6 years ago
  • 2.6.1                                ...           6 years ago
  • 2.6.0                                ...           7 years ago
  • 2.5.0                                ...           7 years ago
  • 2.4.1                                ...           7 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                                ...           8 years ago
  • 2.0.0-rc.5                                ...           8 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                                ...           9 years ago
  • 1.1.1                                ...           9 years ago
  • 1.2.0                                ...           9 years ago
  • 1.1.0                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
  • 0.9.2                                ...           9 years ago
  • 0.9.0                                ...           10 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                                ...           11 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                                ...           12 years ago
  • 0.1.21                                ...           12 years ago
  • 0.1.20                                ...           12 years ago
  • 0.1.19                                ...           12 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.7                                ...           14 years ago
  • 0.1.6                                ...           14 years ago
  • 0.1.5                                ...           14 years ago
  • 0.1.4                                ...           14 years ago
  • 0.1.3                                ...           14 years ago
  • 0.1.2                                ...           14 years ago
  • 0.1.1                                ...           14 years ago
  • 0.1.0                                ...           14 years ago
Downloads
Total 52
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 4
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (327)

© 2010 - cnpmjs.org x YWFE | Home | YWFE