Questions tagged [async.js]

A module with functions for working asynchronously with JavaScript that can be used both in NodeJS and in the browser.

Async is a utility module which provides straight-forward, powerful functions for working with . Although originally designed for use with , it can also be used directly in the browser.

Resources

944 questions
5
votes
1 answer

Does ES6 promises replace the need for async.js methods?

With the introduction of http://es6-features.org/#PromiseUsage in ES6, is https://github.com/caolan/async still relevant? Do async.waterfall and async.series provide any benefit over promises?
karsep5
  • 139
  • 6
5
votes
2 answers

async.waterfall in a For Loop in Node.js

When using async.waterfall within a for loop, it appears that the for loop iterates before the nested async.waterfall finishes all its steps. How can this be avoided? for(var i = 0; i < users.length; i++ ) { console.log(i) …
Nyxynyx
  • 52,075
  • 130
  • 401
  • 707
5
votes
2 answers

Async function nested within async.js waterfall

Disclaimer: non-engineer, very new to JS Hey all - I'm trying to leverage the async.js module to chain a group of functions together. My desired output is to iterate over mapData (array of objects), prior to passing it to the final function (right…
5
votes
1 answer

Is it possible to build a dynamic task list in nodejs Async (waterfall, series, etc...)

I am pulling information from some collections in mongo that contain node and edge data. First i must get the node so i can grab its edges. Once i have a list of edges i then go back out and grab more nodes (etc.. based on a depth value). The…
Jack.Crash
  • 53
  • 1
  • 4
5
votes
2 answers

Q.js: How can I rewrite an async series flow in Q.js?

In an attempt to grasp Q.js, I'd like to convert the following code using async.series in Q.js. Basically I create a folder if it doesn't exist (using mkdirp), move a file into a backup folder and save a file into a main folder. var async =…
roland
  • 7,135
  • 6
  • 42
  • 60
5
votes
1 answer

Return value in a async.forEach in node js?

I'm starting to learn node.js, and to aggregate multiple rss feeds in a single one, I'm fectching the feeds and then recreate a unique feed from the data I fecthed. So, in order to handle multiple http requests asynchronously I use…
xavier.seignard
  • 10,084
  • 12
  • 44
  • 71
4
votes
2 answers

Using async module to fire a callback once all files are read

I'm using caolan's 'async' module to open an array of filenames (in this case, template file names). Per the documentation, I'm using async.forEach(),so I can fire a callback once all operations have completed. A simple test case is: var async =…
mikemaccana
  • 81,787
  • 73
  • 317
  • 396
4
votes
2 answers

Is it poissible to reject each Promise in Promise.allSettled if it takes more than 5 seconds to resolve?

I have a Promise.allSettled which i use to resolve data in the database. I have an array of Promises which I run through the Promise.allSettled, then I only use the resolved ones. Is it possible to set a timeout inside the Promise.allSettled, so…
Benji
  • 169
  • 5
4
votes
1 answer

AWS Lambda async concurrency limits

I'm working on an AWS Lambda function that currently makes hundreds of API calls but when going into production it will make hundreds of thousands. The problem is that I can't test at that scale. I'm using the async module to execute my api calls…
Julian
  • 7,968
  • 6
  • 50
  • 85
4
votes
1 answer

Why is waterfall so slow?

I'm using async module (see https://github.com/caolan/async) for Node.js and my question is... Why is waterfall so slow? It takes about 4 seconds to execute this piece of code... App.post("/form", function(request, response) { Async.waterfall([ …
4
votes
6 answers

Javascript - Callback after all nested forEach loops are completed

I'm sure this is a fairly simple task, but I'm not able to wrap my head around it at this time. I've got a nested set of forEach loops, and I need to have a callback for when all the loops are done running. I'm open to using async.js This is what…
Reza Karami
  • 495
  • 5
  • 13
4
votes
2 answers

chai-http and async.each, throwing "Timeout of 2000ms exceeded..."

I have a simple test with chai-http, in which I try to test several URLs using async.each, but when the request takes more than 2 seconds, then I got the error. it("it should GET the required images", (done) => { async.each(get_data,…
Laerion
  • 695
  • 1
  • 9
  • 17
4
votes
3 answers

Timed version for async waterfall

I want to override async.waterfall() (or write timed_waterfall()) so that it prints execution time for each step. How to do that? async.waterfall([ f=>{ console.log('step1'); f(); }, f=>{ console.log('step2'); …
exebook
  • 27,243
  • 27
  • 105
  • 196
4
votes
4 answers

Nodejs run task in sequence

I am new to node.js and I just don't know how to execute a settimeout function before another function, for example, var async = require('async'); function hello(){ setTimeout(function(){ console.log('hello'); },2000);} function…
Paros Kwan
  • 63
  • 1
  • 6
4
votes
2 answers

Async.js design pattern

I am using async.js for my node.js app. I need help solving the following problem. Let's say I have a following aysnc js series function. async.waterfall([ function getDataFromDB(request, response, callback){ ... }, function…
dejavu
  • 3,086
  • 6
  • 29
  • 58
1 2
3
62 63