async README

The project's README from github.com/caolan/async. As one markdown file: README.md.

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

async (caolan/async)

Searching Database…

28.1K ·GitHub
What is this?Async is a utility module with straight-forward, powerful functions for working with asynchronous JavaScript, originally designed for Node.js.
Is it a library I add to my code, or something I run?It's a library: you install it into your project and call its functions from your own JavaScript code. There is nothing to deploy or run by itself.
How do I add it to a Node.js project?Run npm i async in your project and import the module — that's the whole setup.
Does installing it pull in a bunch of other packages?No — the repo's package.json declares no runtime dependencies, so npm i async adds just this one module.
Does it work with modern ES module imports?Yes — and for purely ESM-based projects there's a dedicated package, async-es, which is a pure ESM version of Async.
Will it work in the browser too, not just on a server?Yes — beyond Node.js it can be used directly in the browser. The main package also ships an ESM/MJS version that bundlers such as Webpack and Rollup pick up automatically.
What do the utilities actually help me do?The README stays broad: functions for working with asynchronous JavaScript. The full API reference lives in the documentation linked from the repo.
Is this a mature, actively developed project?Very — the repository was created in June 2010, has around 28,000 GitHub stars, and is not archived.
Can I use it in commercial projects?Yes. Async is MIT licensed, so it is free to use, modify and ship, including in commercial products.
Creator
caolan
Size
8.2 MB
Stars
28.1K
Age
16y
Commits · 90 Days