Tagged Questions
A module with functions for working asynchronously with JavaScript that can be used both in NodeJS and in the browser.
1
vote
1answer
25 views
Async.js and Angular 2
I need to execute some promises/callbacks in series in Angular 2.
I know Async, which is a very nice library to work with asynchronous tasks. And make it easy to deal with this. But I was not able to ...
0
votes
0answers
16 views
How to return output in node using Async Detect Series
Actually i wanted to return some output based on some asynchronous calls while iterating an array and executing a method over it. When i get a desired response from let's say a Third Party Server, I ...
0
votes
1answer
25 views
process out of memory when using Node and jsdom to spider site
I'm attempting to pull a string from a bunch of HTML pages that I have stored in an array. I have the following code:
const jsdom = require('jsdom')
desc('Import pages');
task('handleSpots', [], ...
0
votes
0answers
15 views
async.retry does not seems to work
I am trying to use dropbox api with async.retry, this should run 10 times, but does not run, what I am doing wrong.
dbx.filesSaveUrlCheckJobStatus({
async_job_id: response.async_job_id
})....
1
vote
1answer
95 views
+50
Async queue, filestream end how to know when both finished
I am having a slight issue when using async.queue with a filestream
I have a scenario where my filestream will finish
I set fileRead to true
however the queue will be empty and already have called ...
1
vote
0answers
21 views
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 ...
-1
votes
1answer
60 views
async - Execute action after loop completed in javascript
I'm trying to develop a synchronous process in node.js, and I have implemented the async.series method, but the way of I've implemented is not working as I expect. I expect the second function of the ...
0
votes
1answer
41 views
Nested async.each: “Error: Callback was already called”
I have having troubles getting my nested async.each work and I am not sure why I'm getting the error: Error: Callback was already called even though I have correctly placed my callbacks.
...
0
votes
1answer
37 views
Asynchronous Mongoose Calls
I've got a match function that pairs or partial-pairs two exchange bets together. At first I wrote a neat function but it was synchronous (using for loops) and now I'm having trouble translating it ...
0
votes
1answer
35 views
javascript nodejs if statements being invoked in unexpected order
Given the code below, i'm assuming i'm running into an async issue.
exports.existingCheck = function (req, res, next) {
var query = [],
message = [],
userObj = {},
i, ...
0
votes
0answers
20 views
how to iterate object with async and save to mongo
I have this async.waterfall:
async.waterfall([
function (callback) {
var dir = 'src/app/server/uploads/pets/' + pets._id + '/posters/';
callback(null, dir);
},
...
3
votes
1answer
75 views
Async each vs forEach js
Can someone explain me the different between this two:
async.each(items, function (item, callback) {
// Do something
});
OR :
items.forEach(function(item) {
// Do something
)};
0
votes
2answers
57 views
Async each function
I'm trying to understand async each(coll, iteratee, callback) function to execute a function in parallel for each item of an array. From the async docs I understand that callback will be executed only ...
0
votes
1answer
24 views
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"...
4
votes
1answer
65 views
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.
...
0
votes
1answer
30 views
nodejs Async.each Nested loop Confusion
i want to have two nested for loops
async.each(ListA,
function(itemA,callback1){
//process itemA
async.each(itemA.Children,
function(itemAChild,callback1){
//...
0
votes
0answers
24 views
running parallel function with different inputs being trasnformed in the same input
I'm trying to run parellel functions with async.js
But when I try to update rows of a database, the async function doesn't handle different inputs.
It updates the same values for the where part, ...
0
votes
1answer
39 views
nodejs: When should I use `setImmediate(cb)` vs `cb()`?
When reading on The Callback Hell , I came across two different ways of calling a callback function in the exact same example linked above (last example in the linked section):
cb();
and then
...
1
vote
1answer
30 views
Async and typeScript class method - Why no access to class property? [duplicate]
Given a simple typeScript class:
class Greeter {
greeting: string;
constructor(message: string) {
this.greeting = message;
}
greet() {
return "Hello, " + this.greeting;
}
...
0
votes
2answers
36 views
Promises not working as expected with async.each
I'm somehow not able to find the solution. Here is what I'm doing:
async.each(bottles, function(bottle) {
// set substance quantity to 0
updateQuantity(bottle[constant....
-1
votes
1answer
22 views
async forEach (async.map) to iterate an api call?
I'm trying my best to learn Node. I posted a similar question a little while ago and "Promises" were mentioned. I've done some reading on promises but was wondering if someone could example it in a ...
0
votes
0answers
28 views
ajax async used instead of rxjs async
I'm introducing NgRx into my Angular 2 application. I'm using async for certain operations. However, somehow, the wrong async (I think the one for AjaxRequest) is being triggered which results in my ...
0
votes
2answers
22 views
Assert arrow function on mocha
I'm trying asserting an action from redux that has an arrow function, and given it creates a new reference, I'm not able to assert it using chai.
Here is the code:
export function save(product) {
...
1
vote
1answer
54 views
nodejs async parallel inside an async each
Firstly I am new to nodejs. Working On an API where I have to do multiple queries inside an each loop. So I started using async module with express. The exact code that I am using is
...
0
votes
1answer
27 views
Async.js filtering an array not working
I am trying to use async's filter method but I am not getting the result I expect
async.filter([1, 3, 5], function (item, done) {
done(item > 1);
}, function (results) {
...
0
votes
2answers
31 views
async.each not iterating when using promises
I am trying to run an asynchronous loop async.each over an array of objects.
On each object in the array, I am trying to run two functions sequentially (using promises). The problem is that async....
-1
votes
1answer
93 views
Node MYSQL execute multiple queries the fastest possible
Which method gets the query to MYSQL, and then comes back to output the "console.log('queries finished', results)" the fastest? Or is there an even better method? Please explain your answer!
Thanks!
...
0
votes
2answers
41 views
Using async In Node Module - How to Return Results? [duplicate]
I am in the process of writing an internal NPM module for my company so that applications can interact with a hardware device we have, which we already have a library written for communicating with it....
0
votes
0answers
29 views
Handling result of first mysql query in second query using node.js
I am newbie to node.js and trying to create an array out of first query result after validating through second query result.
Here, I am not able to set finalresult array hence my res.jsonp is empty ...
1
vote
2answers
48 views
Node.js Iterate CSV File for Requests, but Wait for Response Before Continuing the Iterations
I have some code (somewhat simplified for this discussion) that is something like this
var inputFile='inputfile.csv';
var parser = parse({delimiter: ','}, function (err, data) {
async.eachSeries(...
0
votes
0answers
35 views
using async module in nodejs returns nothing in response
I'm trying to post to Instagram API to authenticate user, but I'm getting null value as response. Before using async, I used setTimeout but it returned the error you must provide a client_id. This is ...
0
votes
1answer
58 views
nodejs async.whilst will only invoke once
As the question states, async.whilst will only invoke once. However, if I pass an array containing 2 objects (length of 2), it will only invoke once -- instead of once for each index of the array.
...
0
votes
1answer
57 views
Deferred.notify() inside async.whilst() doesn't trigger progress handler until callback
I have a function that returns a promise (using Q), and the notifications don't seem to happen at the right time. The onFulfilled and onRejected callback work as intended, but the progress callback ...
1
vote
1answer
48 views
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([
...
3
votes
0answers
49 views
Data manipulation with Node and mongo when Data size is very large
I am currently working with MEAN stack. I have around 99000 records in mongo dB. each record consist of an image array, which is containing image urls. maximum size of this image array can be 10. so ...
0
votes
1answer
78 views
Node.js need to wait for for loop to finish before executing function
Ok. So i'm extremely new to node. my mind is spinning in callback hell right now. i've read through many similar questions but can't seem to get it to run properly.
essentially, i'm parsing through ...
0
votes
2answers
48 views
Synchronous tasks with asynchronous task
I am putting together a validation component on an application which takes a task name (which would be a field name) and a value as it's parameters. For each found form field a task is launched.
If ...
4
votes
3answers
40 views
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(...
0
votes
1answer
47 views
node.js: structure multiple API requests, work on them and combine them
currently I am struggeling a little bit with node.js (I am new to it) doing different API requests (Usabilla API), work on the results and then combine them in order to work on the whole set (e.g. ...
0
votes
1answer
56 views
nodejs loop async.parallel callback
I am testing a callback called by async.parallel functions: it seems that the execution flow is different if the callback uses a parameter or none.
var async = require("async");
function ...
-1
votes
1answer
38 views
Express - Multiple async requests from different endpoints
I'm developing an app with NodeJS and Express. The objective of this app is to provide data that is fetched from multiple different API endpoints, all in one single page.
Unfortunately, I'm ...
0
votes
0answers
51 views
Async with Sequelize and Error Handling: Callback already called
I have several functions that look like this one:
var functions = {
prices: function prices(callback) {
Price.findAll({}).then(function(results){
callback(null, results);
...
0
votes
1answer
24 views
I have query in async.parallel module in nodeJS
I'm trying to use async node module for my project I need it in huge way. when I tried follow code than it's not working. Please any one help me to figure out issue.
async.parallel({
test : ...
0
votes
0answers
51 views
Get items of multiple arrays with async
I'm using async in my Node.js application and I don't understand how can I pass multiple arrays to async.each() in parameter and get the good current item. Actually I do this but this is not the good ...
0
votes
1answer
33 views
Async.js: Is a variable created in a waterfall task available in another task?
I am freshly discovering Async.js and I wondered what was the behavior of async.waterfall when a document is found by a database query, and how to use it through different tasks.
I have this piece of ...
-2
votes
2answers
31 views
getting async nodejs value from each callback calls [duplicate]
var async = require('async');
var square = function (id, callback) {
Business.prototype.getBusinessUser(id,function(userObject){
return callback(userObject);
});
};
async.eachSeries(...
0
votes
1answer
50 views
nodejs async.parallel recursion
I am test async.parallel behaviour with nodejs.
var async = require("async");
function makeSleepFunction(i) {
return function(callback) {
setTimeout(function() {
console.log(' + ...
0
votes
0answers
66 views
NodeJS Callback not a function Async waterfall
I've been writing a simple server, and have come across an issue where I get a callback undefined error, despite having a callback parameter in my function header. Every example I've seen on Google ...
3
votes
1answer
45 views
Getting partial results using async.js mapValues
I was looking for a way to get results of mongoose js easy, simply by writing the query as you can see above:
Article.find().skip(data.skip)
And if i want to add another query, just i put the query ...
0
votes
1answer
26 views
Using Express.js's res.send() with async.each
async1.each(arr, function(arrayMember) {
orders.where('name', arrayMember).fetch({withRelated: ['allOrders']}).
then(function(dd2, callback) {
dd2 = dd2.toJSON();
var sendMemberOrder = ...