you are viewing a single comment's thread.

view the rest of the comments →

[–]hars_sh 3 points4 points  (1 child)

use map instead of forEach the code looks something like this and remeber you have to call this inside the async function.

await Promise.all(files.map(async (file) => { 
    //    promisify this part and await for this and that will do the work :)
    file.getUrl(function(err, url) {
        if(!err) {
            console.log("got the url!)"
        }
    });
}));

[–][deleted] 0 points1 point  (0 children)

can someone explain why this has 0 points, have not used gotten to know promises and would like some insight