nodejs Async s whilst

0 votes
I intended to call a function several times, but only after the previous call was done. Does the Async's fit what I'm looking for? Or do the calls happen at the same time?

Thanks a lot for your response.
May 27 in Node-js by Vaani
• 7,020 points
18 views

1 answer to this question.

0 votes

While it will accomplish your goals, it will do it in a sequential manner. It will run the "test" function before each run to ensure that it should run again.

Their example is as follows:

var count = 0;

async.whilst(
    function () { return count < 5; },
    function (callback) {
        count++;
        setTimeout(callback, 1000);
    },
    function (err) {
        // 5 seconds have passed
    }
);
answered May 27 by Neha
• 8,560 points

Related Questions In Node-js

0 votes
1 answer

How do I “include” functions from my other files in nodejs?

Hello @kartik, You require any js file,so you just ...READ MORE

answered Jul 9, 2020 in Node-js by Niroj
• 82,720 points
1,503 views
0 votes
1 answer

Error: listen EADDRINUSE while using nodejs?

Hello @kartik, EADDRINUSE means that the port number which listen() tries ...READ MORE

answered Jul 9, 2020 in Node-js by Niroj
• 82,720 points
2,047 views
0 votes
1 answer

Error:npm WARN unmet dependency in nodejs

Hii @kartik, Following are the possible solution : Manually ...READ MORE

answered Jul 12, 2020 in Node-js by Niroj
• 82,720 points
2,682 views
0 votes
1 answer

How nodejs get file name from absolute path?

Hello @kartik, Use the basename method of the path module: path.basename('/foo/bar/baz/asdf/quux.html') // returns 'quux.html' If you ...READ MORE

answered Jul 14, 2020 in Node-js by Niroj
• 82,720 points
2,463 views
0 votes
1 answer

nodeJs callbacks simple example

var myCallback = function(data) { console.log('got ...READ MORE

answered Jun 17 in Node-js by Neha
• 8,560 points
13 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
971 views
0 votes
1 answer
0 votes
1 answer

Nodejs instagram-web can't save login session locally

There are several things you can do: Dictionary ...READ MORE

answered May 27 in Node-js by Neha
• 8,560 points
25 views
0 votes
1 answer

NodeJS - Upload ~36MB file to VirusTotal failing

The VirusTotal file/scan API request has a ...READ MORE

answered May 27 in Node-js by Neha
• 8,560 points
25 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP