# async

> Higher-order functions and common patterns for asynchronous code

Latest version **3.2.6** (published 2024-08-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install async
pnpm add async
yarn add async
bun add async
```

## Health

**Score 43/100 (D)** — status: abandoned.

Positive: has types package; esm support; no vulnerabilities; high quality score; popular repo.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.2.6 |
| Published | 2024-08-19 |
| First published | 2010-12-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/async) |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 788.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 28132 |
| Author | Caolan McMahon |
| Maintainers | beaugunderson, caolan, aearly, megawac, hargasinski |
| Keywords | async, callback, module, utility |

## Links

- npm: https://www.npmjs.com/package/async
- Repository: https://github.com/caolan/async
- Homepage: https://caolan.github.io/async/
- Issues: https://github.com/caolan/async/issues
- npm.io page: https://npm.io/package/async

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 3.2.6 (latest) — 2024-08-19
- 3.1.0 (next) — 2019-06-23
- 3.2.5 — 2023-11-03
- 3.2.4 — 2022-06-07
- 2.6.4 — 2022-04-13
- 3.2.3 — 2022-01-10
- 3.2.2 — 2021-10-28
- 3.2.1 — 2021-08-05
- 3.2.0 — 2020-02-24
- 3.1.1 — 2020-01-24
- 2.6.3 — 2019-07-14
- 3.0.1 — 2019-05-26
- 3.0.0 — 2019-05-20
- 2.6.2 — 2019-02-12
- 3.0.1-0 — 2018-10-01
- … 78 more at https://npm.io/package/async/versions

## README

![Async Logo](https://raw.githubusercontent.com/caolan/async/master/logo/async-logo_readme.jpg)

![Github Actions CI status](https://github.com/caolan/async/actions/workflows/ci.yml/badge.svg)
[![NPM version](https://img.shields.io/npm/v/async.svg)](https://www.npmjs.com/package/async)
[![Coverage Status](https://coveralls.io/repos/caolan/async/badge.svg?branch=master)](https://coveralls.io/r/caolan/async?branch=master)
[![Join the chat at https://gitter.im/caolan/async](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/caolan/async?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/async/badge?style=rounded)](https://www.jsdelivr.com/package/npm/async)

<!--
|Linux|Windows|MacOS|
|-|-|-|
|[![Linux Build Status](https://dev.azure.com/caolanmcmahon/async/_apis/build/status/caolan.async?branchName=master&jobName=Linux&configuration=Linux%20node_10_x)](https://dev.azure.com/caolanmcmahon/async/_build/latest?definitionId=1&branchName=master) | [![Windows Build Status](https://dev.azure.com/caolanmcmahon/async/_apis/build/status/caolan.async?branchName=master&jobName=Windows&configuration=Windows%20node_10_x)](https://dev.azure.com/caolanmcmahon/async/_build/latest?definitionId=1&branchName=master) | [![MacOS Build Status](https://dev.azure.com/caolanmcmahon/async/_apis/build/status/caolan.async?branchName=master&jobName=OSX&configuration=OSX%20node_10_x)](https://dev.azure.com/caolanmcmahon/async/_build/latest?definitionId=1&branchName=master)| -->

Async is a utility module which provides straight-forward, powerful functions for working with [asynchronous JavaScript](http://caolan.github.io/async/v3/global.html). Although originally designed for use with [Node.js](https://nodejs.org/) 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`](https://www.npmjs.com/package/async-es).

For Documentation, visit <https://caolan.github.io/async/>

*For Async v1.5.x documentation, go [HERE](https://github.com/caolan/async/blob/v1.5.2/README.md)*


```javascript
// 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);
});
```

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

---
_Source: https://npm.io/package/async · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
