async (2.6.4)
Published 2026-02-24 13:53:08 +00:00 by atheaadmin
Installation
registry=npm install async@2.6.4"async": "2.6.4"About this package
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 install --save async, it can also be used directly in the browser.
This version of the package is optimized for the Node.js environment. If you use Async with webpack, install async-es instead.
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)
})
Dependencies
Dependencies
| ID | Version |
|---|---|
| lodash | ^4.17.14 |
Development Dependencies
| ID | Version |
|---|---|
| babel-cli | ^6.24.0 |
| babel-core | ^6.26.3 |
| babel-plugin-add-module-exports | ^0.2.1 |
| babel-plugin-istanbul | ^2.0.1 |
| babel-plugin-transform-es2015-modules-commonjs | ^6.26.2 |
| babel-preset-es2015 | ^6.3.13 |
| babel-preset-es2017 | ^6.22.0 |
| babelify | ^8.0.0 |
| benchmark | ^2.1.1 |
| bluebird | ^3.4.6 |
| browserify | ^16.2.2 |
| chai | ^4.1.2 |
| cheerio | ^0.22.0 |
| coveralls | ^3.0.1 |
| es6-promise | ^2.3.0 |
| eslint | ^2.13.1 |
| fs-extra | ^0.26.7 |
| gh-pages-deploy | ^0.5.0 |
| jsdoc | ^3.4.0 |
| karma | ^2.0.2 |
| karma-browserify | ^5.2.0 |
| karma-firefox-launcher | ^1.1.0 |
| karma-mocha | ^1.2.0 |
| karma-mocha-reporter | ^2.2.0 |
| mocha | ^5.2.0 |
| native-promise-only | ^0.8.0-a |
| nyc | ^11.8.0 |
| rimraf | ^2.5.0 |
| rollup | ^0.36.3 |
| rollup-plugin-node-resolve | ^2.0.0 |
| rollup-plugin-npm | ^2.0.0 |
| rsvp | ^3.0.18 |
| semver | ^5.5.0 |
| uglify-js | ~2.7.3 |
| yargs | ^11.0.0 |
Keywords
async
callback
module
utility
Details
Assets (1)
Versions (3)
View all
async-2.6.4.tgz
120 KiB
