• Stars
    star
    28,046
  • Rank 634 (Top 0.02 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 14 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Async utilities for node and the browser

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

More Repositories

1

highland

High-level streams library for Node.js and the browser
JavaScript
3,424
star
2

nodeunit

Easy unit testing in node.js and the browser, based on the assert module.
JavaScript
1,907
star
3

jam

JavaScript package manager - using a browser-focused and RequireJS compatible repository
JavaScript
1,497
star
4

forms

An easy way to create, parse and validate forms in node.js
JavaScript
1,011
star
5

pithy

An internal DSL for generating HTML in JavaScript
JavaScript
435
star
6

nimble

A really tiny functional JavaScript and async flow-control library
JavaScript
329
star
7

petrify

A flexible static site generator for node.js
JavaScript
259
star
8

cookie-sessions

Secure cookie-based session middleware for Connect
JavaScript
97
star
9

quip

A chainable API for response objects in node
JavaScript
93
star
10

dispatch

A regular expression URL dispatcher for Connect
JavaScript
84
star
11

magery

JavaScript templates for progressive enhancement
JavaScript
54
star
12

copykitten

Tiny immutable JSON data structures
JavaScript
40
star
13

jquery.notify.js

Ubuntu-style notifications within a web browser
JavaScript
25
star
14

couchr

Lightweight CouchDB request library for Node and the browser
JavaScript
22
star
15

hoodie-drawing

Hoodie drawing demo app
JavaScript
21
star
16

cpm

CouchDB Package Manager - a tool for the management of CouchApps and associated libraries
JavaScript
16
star
17

blog

CouchApp code used to run my blog
JavaScript
15
star
18

wmd

wanton markdown - a markdown parser based on showdown
JavaScript
14
star
19

tamawiki

I'm learning Rust!
Rust
13
star
20

chicken-toml

A TOML parser for CHICKEN Scheme built with comparse
Scheme
11
star
21

docker-hoodie

Basic docker file for trying out hoodie
Shell
10
star
22

bootstrap-less

Kanso package providing uncompiled less files for bootstrap with images and js as attachments
JavaScript
10
star
23

behaviors

A (really) simple way to check a modules export's in node.js. Inspired by behaviors in Erlang.
JavaScript
9
star
24

snowy

HTTP server for CHICKEN Scheme
C
8
star
25

events

Browser port of the node.js events module
JavaScript
8
star
26

lolcorp

Intentionally insecure example Node.js applications
JavaScript
7
star
27

raspberry-pi-gpio

Raspberry Pi GPIO library for CHICKEN Scheme
Scheme
6
star
28

scrawl

Dumb comment parsing
JavaScript
6
star
29

pithy2

A Typescript-friendly and human-friendly API for building DOM elements
TypeScript
5
star
30

snake

Snake game for the BBC micro:bit
Python
5
star
31

python-magery

Python implementation of Magery templates
Python
5
star
32

erlmpd

An Erlang client module for MPD
Erlang
5
star
33

chicken-leveldb

CHICKEN Scheme bindings to LevelDB
Scheme
5
star
34

highland-couchr

Highland streams style API to CouchDB, using couchr under the hood
JavaScript
4
star
35

chicken-sodium

CHICKEN Scheme bindings to libsodium crypto library
Scheme
3
star
36

0

3
star
37

ghstats

allows you to compare github users followers and project watchers
JavaScript
3
star
38

couchr-browser

Lightweight library for making CouchDB requests, based on jQuery
JavaScript
2
star
39

couchi

CouchDB command-line interface
JavaScript
2
star
40

magery-tests

Test suite for server implementations of Magery templates
HTML
2
star
41

chat

Kanso chat app
JavaScript
2
star
42

condor

C O N D O R
JavaScript
2
star
43

lmdb-lolevel

Low-level CHICKEN Scheme bindings to LMDB, closely following the C API
Scheme
2
star
44

chicken-ldap-bind

Implements LDAP bind for authentication using OpenLDAP
Scheme
2
star
45

chicken-level

abstract API layer for chicken-leveldb
Scheme
2
star
46

gamejam

First Play Sheffield Game Jam!
JavaScript
2
star
47

library

CouchApp for storing templates
JavaScript
2
star
48

chicken-gumbo

C binding to the Gumbo HTML parser for CHICKEN Scheme
Scheme
2
star
49

dust

P2P event streams
Scheme
2
star
50

users-core

Core resources for the users app, must be used with a theme (eg, users-default)
JavaScript
2
star
51

gh-label-dashboard

An example of using the github search API to query labels across all repositories in an organisation
1
star
52

validatejs

JavaScript
1
star
53

webhook-test

1
star
54

users-default

Default bootstrap theme for users app
1
star
55

chicken-sublevel

Namespaced access to leveldb implementations
Scheme
1
star
56

chicken-level-sexp

Automatically read and write s-expressions to leveldb
Scheme
1
star
57

chicken-fnmatch

Test filenames against shell wildcard patterns using fnmatch
Scheme
1
star
58

jambot

IRC bot for #jamjs
JavaScript
1
star
59

mochiproxy

Easily proxy mochiweb requests, based on the CouchDB proxy module
Erlang
1
star
60

highland-couchdb-alldocs

Provides Highland streams for reading all keys/docs in a CouchDB database
JavaScript
1
star