Questions tagged [node-async]

Async is a utility module for node.js (although it can also be used in the browser) that provides powerful functions for working with asynchronous JavaScript

Async provides around 20 functions that include the usual 'functional' suspects (map, reduce, filter, each...) as well as some common patterns for asynchronous control flow (parallel, series, waterfall...).

All these functions assume you follow the convention of providing a single callback as the last argument of your async function.


Documentation :

185 questions
6
votes
1 answer

Is there an equivalent statement to 'continue' when using node.js async forEachSeries?

I am using the node.js async package, specifically forEachSeries, to make a series of http requests based on parameters drawn from an array. In the callback of each request I have some if/else statements to respond to different types of…
TankofVines
  • 1,107
  • 2
  • 14
  • 23
5
votes
1 answer

Moving 100.000+ files in Node.js sync / async performance and speed

I'm trying to figure out the fastest way without affecting performance much while moving either synchronously or asynchronously 100.000+ files using Node.js I made sync and async tests with 3 different looping forEach async.each and for. The loop…
Systems Rebooter
  • 1,281
  • 2
  • 14
  • 30
5
votes
1 answer

Pause/Timeout in async.forEach NodeJS

So lets say fruits is an array containing 4 items What I expected was that the code below would print fruit with a 4 second delay between each fruit. var fruits = ['blueberries', 'strawberries', 'mango', 'peaches']; async.forEach(fruits,…
koikoi
  • 107
  • 1
  • 6
5
votes
3 answers

Asynchronous http calls with nodeJS

I would like to launch asynchronous http calls on my server node, i saw the async node module and i guess the async.parallel enables us to do that. The documented example is pretty clear, but i don't know how i could manage multiple http calls. I…
Ludo
  • 5,060
  • 15
  • 53
  • 85
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
  • 110,530
  • 99
  • 389
  • 494
4
votes
2 answers

Slow http request in node server

In my application, I have to create an API for searching n items. The server logic is to find for items in it's own database and if the result count is less than n, then use search results from a third party service to fill in the remaining…
Amresh Kumar
  • 1,445
  • 17
  • 30
4
votes
2 answers

Increase of parallel requests form node.js to external system takes more time to respond

I have a simple case where I'm requesting a different upstream proxy server from my node.js server. With the increase in load I see the request takes lot of time to execute(though time taken to respond from my upstream proxy server is constant…
Kishore Yekkanti
  • 961
  • 2
  • 7
  • 16
4
votes
1 answer

handling error in async waterfall with expressjs

I don't see why expressjs don't handle error when it's throw in async.waterfall var express = require('express') , app = express.createServer() , async = require('async'); app.use(express.errorHandler({ dumpExceptions: true, showStack:…
PierrickP
  • 107
  • 7
3
votes
1 answer

NodeJS sending shuffled data as API response

I have written an API endpoint which sends back the username of n number of users as response after going through an array which contains n number of user id's. Here is the code that I am talking about, //Fetch username of…
Mat
  • 35
  • 3
3
votes
2 answers

async each variable scope in nodejs

I am using async each to loop through and constructing an object called coupon_bo. Surprisingly inside processbo function, I am seeing a side effect where only the last copy of coupon_bo object is available to processbo function. My understanding…
Madhur Ahuja
  • 22,211
  • 14
  • 71
  • 124
3
votes
1 answer

async.waterfall inside async.each doesn't work?

I'm trying to run an async.each over an array of items. For each item, I want to run an async.waterfall. See code below. var ids = [1, 2]; async.each(ids, function (id, callback) { console.log('running waterfall...'); …
fooser
  • 822
  • 6
  • 14
3
votes
3 answers

Nodejs async: How to map keys to key-values?

I can't to find a method of async.js library for followed: I have: keys array ['a', 'b', 'c'] iterator like: function it(item, next){ next(null, item+item); } If I use async.map([1, 5], it, cb), I get [2, 10]. How can I get {…
vp_arth
  • 14,461
  • 4
  • 37
  • 66
3
votes
1 answer

Dealing with socket.io async get/set calls

I'm trying to interrogate if any of the clients in a room have a particular property associated with them. The async nature of the socket.io get method is causing me problems. I've seen the async library, which looks like it might be what I need,…
Dan Steele
  • 1,644
  • 3
  • 13
  • 13
3
votes
2 answers

passing parameters to Node.js async waterfall

I need to pass some parameters to the initial function of async waterfall(). The proposed method https://github.com/caolan/async/issues/14 does not work for me as I need to pass it the response from an ExpressJS function exports.categories = (req,…
cyberwombat
  • 38,105
  • 35
  • 175
  • 251
2
votes
1 answer

ldapjs advanced search on subtree

Iam using ldapjs library for my project with standard LDAP server and iam trying to using search(). Its working right until i want to return results. So i believe its more my misunderstanding of how javascript works rather than library as its…
Jakub Koudela
  • 160
  • 1
  • 18
1
2
3
12 13