Async/Await is not working with node 4.x. Can i have the alternate?

后端 未结 3 1632
走了就别回头了
走了就别回头了 2021-01-27 21:39

Getting below error when i try to use async/await with NodeJs 4.x. Any issue with the below sample code or should i use alternate ?

async function main ()

3条回答
  •  忘掉有多难
    2021-01-27 22:21

    try async.js http://caolan.github.io/async/

    var async = require("async");  
    async.map(['file1','file2','file3'], fs.stat, function(err, results) {
        // results is now an array of stats for each file
    });
    
    async.parallel([
        function(callback) { ... },
        function(callback) { ... }
    ], function(err, results) {
        // optional callback
    });
    

提交回复
热议问题