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
7
votes
2 answers

Asynchronous tree traversal using async.js

I'm trying to traverse a tree of nested of items using async.js. The traversal terminates after going through just one branch. var count=0; exports.buildFamily = function(item_id, mback){ var extendedFamily={}; exports.getItembyId(item_id,…
Kinnard Hockenhull
  • 2,112
  • 5
  • 23
  • 32
7
votes
2 answers

Using nodejs async and request module

I'm trying to use async and request module together but i don't understand how the callbacks get passed. My code is var fetch = function(file, cb) { return request(file, cb); }; async.map(['file1', 'file2', 'file3'], fetch, function(err, resp,…
andrei
  • 6,944
  • 13
  • 47
  • 63
6
votes
2 answers

Creating excel file and writing to it with ExcelJS

I wrote a script that creates a new excel file with ExcelJS. Adds 3 headers and inserts 2 rows. Then saves that file to disk. In the next step it should read that previously saved file, add 1 row and save it again under a new name. I can't find the…
miyagisan
  • 625
  • 1
  • 4
  • 14
6
votes
1 answer

Provide Task type for async queue using generics

I have this right now: export type EVCb = (err:any, val?:any) => void; export type Task = (cb: EVCb) => void; export const q = async.queue((task: Task, cb) => task(cb), 2); Isn't there a way to give async.queue type information about the task using…
Alexander Mills
  • 1
  • 80
  • 344
  • 642
6
votes
1 answer

Pass array to async library eachSeries - expects 'Dictionary<{}>'

I have the following TypeScript code: const allDescribeBlocks: Array = suman.allDescribeBlocks; async.eachSeries(allDescribeBlocks, function (block: ITestSuite, cb: Function) { //.... }, cb); this will transpile with…
Alexander Mills
  • 1
  • 80
  • 344
  • 642
6
votes
1 answer

Insert a large csv file, 200'000 rows+, into MongoDB in NodeJS

I'm trying to parse and insert a big csv file into MongoDB but when the file extends 100'000 rows I get a bad response from the server. And the files I need to insert are usually above 200'000 rows. I've tried both bulk insert (insertMany) and…
hxmn
  • 71
  • 1
  • 4
6
votes
1 answer

nodejs and async.waterfall with if conditions and conditional function list.

I have been working with async.waterfall and nodejs. Its working very well but now I have a question about flow. I want to use a simple if condition in async.waterfall flow. async.waterfall([ callOne, callTwo, if(condition > 0 ) { …
philipfwilson
  • 701
  • 1
  • 7
  • 20
6
votes
1 answer

Async.js - ETIMEDOUT and Callback was already called

I keep getting an ETIMEDOUT or ECONNRESET error followed by a Callback was already called error when I run index.js. At first I thought it was because I was not including return prior to calling the onEachLimitItem callback. So I included it per the…
Blexy
  • 9,197
  • 5
  • 35
  • 51
6
votes
2 answers

Async.retry executes immediately before waiting for interval

async.retry({times : 25,interval : 30000},myFunction.bind(functionData),function(err,results){ console.log("===================================") console.log("Async function finished processing") return; }) myFunction is called immediately and that…
Vikas Sharma
  • 71
  • 1
  • 2
6
votes
1 answer

Nesting node async.eachSeries

Been fighting with async module for half a day but can't get it to work properly when nesting few levels. So this works ok: var async = require('async') var myarr = ["Outer - A", "Outer - B"]; var myarr2 = ["Inner - A", "Inner - B"]; …
Timo Wallenius
  • 447
  • 5
  • 15
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
  • 827
  • 1
  • 11
  • 23
5
votes
1 answer

editing subdocments N-N relationship in mongodb

I have an application where an article can be linked to multiple platforms. Article contains a list of platforms and platforms also contains a list of articles. For more detailed information please look at this stackoverflow question that I asked a…
Erik Westra
  • 151
  • 1
  • 11
5
votes
2 answers

Node MySQL execute multiple queries the fastest possible

Which is the fastest method gets the query to MYSQL, and then comes back to output: console.log('queries finished', results)" Is there an even better method? Please explain your answer! Thanks! Method 1: var connection =…
user2278120
  • 585
  • 2
  • 7
  • 19
5
votes
1 answer

How to code with Promise from async.js?

Background I usually write node.js script based on async.js to control the work flow. Sometimes I found that based on async.js, the code seems still a 'hell'. With multiple nest the code is not readable and tricky to maintain. I did some search here…
J.Lyu
  • 892
  • 7
  • 15
5
votes
1 answer

RxJS equivalent of Async.js mapLimit

Async.js mapLimit and its family of Limit functions basically work like a semaphore: they allow a limited number of tasks to run concurrently while the extra incoming tasks are added to a queue. The queue becomes a (cold? connected?) producer.…
homam
  • 1,747
  • 1
  • 15
  • 24
1
2
3
62 63