Tuesday, 4 April 2017

async.each - what's the callback for?

I just want check a list of urls to see if each exists and continue after all have been done:

var urls = [ "http://...", "http://...", ... ];

async.each(urls, function(url, ??callback??) {
             http.get(url, function(response) {
                 console.log(response.statusCode);
             });
           }, function(err) {
                if (!err)
                   console.log("All urls called");
           });

What do I put for ??callback?? when I have nothing to continue after each task is completed? The documentation doesn't indicate it is optional.



via Old Geezer

No comments:

Post a Comment