A module with functions for working asynchronously with JavaScript that can be used both in NodeJS and in the browser.
0
votes
1answer
22 views
Nodejs, Typescript, typings: how to use async library
I'm trying to use the async library in Typescript; I've installed the definition file that was provide by typings but I cannot use AsyncFunction:
///<reference path='typings/index.d.ts' />
'use ...
0
votes
3answers
63 views
proper way to do while loop async in javascript
I wonder what is the proper way to do this?
while(newList.length < 10){
async.series([
function(callback){
async.eachSeries(rest,function(...
3
votes
2answers
4k views
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 ...
3
votes
2answers
74 views
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 ...
1
vote
1answer
27 views
processing highland stream chunks using async
I'm using highland.js to process a file using a stream to read the contents between two delimiters. I'm also using async.js to run a series of http requests in sequence.
Ideally I would like to pass ...
0
votes
0answers
67 views
Callback was already called, why?
I am always getting "Error: Callback was already called." when the field bar (doc.bar) is not set (see the comment).
I am using async.js, express and mongodb.
Does somebody find the error? I do not.
...
0
votes
0answers
8 views
async parallel calls using async js llin
arrayOfFunctions is an array with 1000+ functions in it. Each function is making an async call to AWS S3 to get an object's metadata.
Function:
function (cb) {$.when(getMetadata("bucketname","...
1
vote
2answers
47 views
Test async.waterfall in node.js with sinon.js timers
I have the following function that I wish to be tested which use async.js heavily in it:
MyClass.prototype.pipeline = function(arg1, arg2) {
...
async.waterfall([
async.apply(self.a.f....
2
votes
1answer
25 views
Multiple get requests with request-json not executing properly with async in node js
My requirement is that I need to load JSON data from multiple REST resources. For this I need to make multiple get requests. I need to perform some function when all the requests have been completed.
...
0
votes
1answer
18 views
async.map not working as expected
I am trying to loop though a collection and append an array of objects from a related collection. The result I am getting does not contain that array.
Can anyone help me spot the issue?
The model ...
1
vote
2answers
33 views
Async.js series and node-mysql query's cant get rows
I am currently trying to run a set of MySQL query's in order using async.js series control flow function. But I keep receiving the following error:
throw err; // Rethrow non-MySQL errors
^
...
0
votes
0answers
29 views
Node.js sinon test async.js waterfall function
Consider the following scenario:
function MyClass() { ... }
MyClass.prototype.funcToTest = function() {
varl self = this;
async.waterfall([
async.apply(self.a.func.bind(self.a), 5, '...
1
vote
2answers
88 views
use promise series instead async series
I use the following async.js code
var arr = ['1', '2'];
async.mapSeries(arr, getInfo, (e, res) => {
console.log(res);
});
function getInfo(name, callback) {
setTimeout(() => {
...
0
votes
0answers
19 views
How to use async to run post-command in node.js
I am now working on Node.js project and have no idea how to handle the below problem.
When I delete project from db, because project id used as foreign key in Image table, I am going to delete ...
0
votes
2answers
42 views
nested Async not executing as expected
I am new to node js and I am trying to use async module to eliminate the setTimeouts. Here I am facing a problem. It is not working as expected. It calls the second function even before the first ...
0
votes
2answers
546 views
SOLVED: How to block process and wait for result on Node.js?
I am facing a problem with Node.js (v0.12.7). I am writing an application that must be stopped somewhere and wait for a result from a query to database and then what it is doing.
And the problem is ...
23
votes
7answers
15k views
Iterating over a mongodb cursor serially (waiting for callbacks before moving to next document)
Using mongoskin, I can do a query like this, which will return a cursor:
myCollection.find({}, function(err, resultCursor) {
resultCursor.each(function(err, result) {
}
}
However, I'd ...
0
votes
1answer
28 views
ECONNRESET when using async to scrape archive
I am currently trying to get some article data for a TensorFlow implementation I'm working on. The first source I am trying to pull against is Buzzfeed. I'm using the node.js async.js library to ...
0
votes
0answers
62 views
Return value with async function
Right now I have a piece of code which makes two http requests in parallel.
var request = require('request');
var async = require('async');
var fs = require('fs');
module.exports = {
req : ...
0
votes
1answer
81 views
using Async in Meteor 1.3+
Hi guys I want to use Async NPM package and eachLimit function in Meteor 1.3+ I used it later without Meteor like below and it's worked well:
var items = ["test", "test2","test3","test4","test5","...
3
votes
3answers
2k views
What is the difference between async.map or async.each with async.parallel?
I started working on a node project recently and have been using the async library a lot. I'm kind of confused as to which option will be faster. Using async.map on some data and getting its results ...
0
votes
1answer
31 views
How to send two values of the same collections with async.each method?
I am trying to calculate the distance between n points using the google distance matrix api.
Here is the code
var sum=0;
for(i=1;i < locations.length;i++){
var origin = locations[i-1];
var ...
0
votes
1answer
45 views
Is it possible to finish async.js loop early?
I am looking for a way to finish async.js loop early before all the callbacks get called. Is there any built-in function to do so? If not, is there any way around to achieve the desired functionality?
...
0
votes
0answers
29 views
Why does async waterfall differentiate between multiple callbacks in the function array?
async.waterfall([
function(cb) {
console.log('Inner 1');
cb(null, '1st');
cb(null, '1st-Again')
console.log('After 1');
},
function(val, cb) {
console.log('...
0
votes
1answer
23 views
Chaining forEachOf in async.js
Using async.js for the first time and feeling like I'm just totally missing something as I got to a working state through brute force and I'm not confident it'll work with any other set of data. Would ...
0
votes
1answer
37 views
async.js explanation required for understanding callback error argument
This might be an easy question, but I am writing to ask a question because I simply do not get it. What is the use of the argument 'null' in the async.some example below? According to the ...
1
vote
1answer
50 views
Pass parameter to async.js task
I have to iterate through a given JSON object and create a task for each object in there. The given tasks require information from this JSON object as well and I wonder how I can pass these ...
0
votes
1answer
36 views
Missing error handler on `socket` TypeError: task is not a function - node.js async.js
I need your help with my webserver controlled robot project.
I try to control two motors via website.
A lot of stuff is already working so I can open a website and hit the "w" key and both Motors ...
1
vote
1answer
54 views
async foreach call not synchronous node
I want to loop through some predictions of participants and calculate some points.
To know how many points a player gets I need to make a call to mongodb (using mongoose). Then I want to save the ...
0
votes
0answers
36 views
Why async.series doesn't respect the order of my tasks?
I have a collection with many documents like these samples :
Direct flight <=> Stops == 0 && Thru_Point == ""
{
"Orig" : "PTH",
"Dest" : "GMP",
"Flight" : 126,
"Stops" : 0,...
1
vote
0answers
76 views
Node.js Module async.series not working properly
I'm working on MongoDB 2.6.9 and NodeJs 0.10.37 and I have a collection vols which means flights.
According to my previous question, I have a large collection vols with documents like these samples :
...
2
votes
0answers
75 views
Error handling Async Waterfall with nested callbacks
I am using async.parallel inside async.waterfall( [] , function() ). The code is as follows:
async.waterfall(
[
function first(callback) {
//some processing
callback();
},
...
1
vote
1answer
48 views
Iterator v.s. iteratee
Is this difference significant? Is it:
iterator = some abstraction of iterating over a set of data structures
iteratee = the actual data structure being iterated over
I'm reading through async's ...
1
vote
1answer
56 views
How can I manage Node.js async variable scope?
I have the following code for populating my test database. The goal is to save the parent document after each of the child documents to the parent can have a reference to them.
function saveRecipe(...
0
votes
1answer
50 views
Node Async - Working async method returns undefined inside async.parallel
Basically I have a method fetching values from an API and works, but inside async.parallel the results listed are all undefined.
Here's the method:
function getNumberOfSharesFromFacebookApi(url ,...
-1
votes
1answer
38 views
How to implement set of async task with some condition in series?
I have to write the following code in nodejs:
val1 = async1()
if(val1 == 0){
val1 = async2()
}
val2 = async3(val1)
In the above code, val1 and val2 are the values returned from asyncronous ...
0
votes
0answers
24 views
Design pattern to render htmls from node
Consider the following flow written in async.js
async.waterfall([
function getDataFromDB(request, response, callback){ ... },
function ifUserNotLoggedIn(dbData, response, callback) {//...
4
votes
1answer
55 views
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, ...
0
votes
2answers
184 views
Nested loops using async.js
I want to do a very simple code, where I have two nested loops in javascript that print out the index they are currently on. (it's the base for something else i want to do). The inner loop has a timer,...
0
votes
1answer
52 views
async.js return value form last function
I would like create find method in my User object. This function should returns user. But for this example it returns only the text.
But I don't know how return value for waterfall.
When I run
...
2
votes
1answer
75 views
Node.js: async.map getting slower
Hello,
I use Node.js to provide an API for storing data on a MongoDB database.
I ran multiple tests on a read method, which takes ids and returns the corresponding documents. The point is that I ...
1
vote
1answer
72 views
What is the async.retryable pattern for async.waterfall?
The async documentation shows a retryable example for async.auto but I am wondering what the pattern looks like for async.waterfall? I have been unable to track down any examples. Would it look ...
1
vote
1answer
109 views
How do I execute async.map function in order of array contents
I've got the following code routine that works great. The only problem is that I need the results to come back in the same order of the links array. For example I need the results of the google.com ...
0
votes
0answers
31 views
Call_and_retry_last Allocation failed - process out of memory
I am trying to execute the following code but i am encountering CALL_AND_RETRY_LAST allocation failed - process out of memory error. I have tried to resize the process memory but it did not work.
I ...
0
votes
1answer
52 views
nesting loop with forEachSeries and whilst together
I am using forEachSeries and whilst together as follows:
async.forEachSeries(BJRegion, function (region, key, callback) {
var count = 0;
async.whilst(
function () { return count < 10; },
...
0
votes
1answer
185 views
async.parallel: Type Error, task is not a function
What is wrong with this code ?
async = require("async");
fs = require("fs")
async.parallel(['calc.js','index.js'], fs.stat, function (err, results) {
if (err){
console.log(err);
}
else{
...
0
votes
0answers
36 views
async.map within async.parallel produces unexpected output
I'm trying to save an object with multiple nested objects, so i wrote different functions to handle each nested objects and when done, get them all saved in a callback function.
For that, I used the ...
0
votes
0answers
42 views
Javascript multiple image.onload asynchronous callback using async.js
I am using async.js library to load images. The problem occurs when the image source is not available. Since async.js waits for asynchronous calls to finish, it takes too much time when there is an ...
0
votes
1answer
1k views
bluebird vs async.js performance
I understand that promise libraries provide clarity of code structure.
But are they faster?
I am using async.js 'each' to loop through asynchronous xmlHttpRequests. Will it be faster if I adopt ...
0
votes
2answers
681 views
TypeError: Callback is not a function with asyncJS in nodeJS
I want to write a function which calls itself with multiple synchronous calls (the code here is just a stripped example of the flow). The problem is that nodeJS is giving me a "TypeError: asyncCb is ...