使用async.eachSeries只遍历数组的第一个,callback函数不运行(也并不报错)

如题,使用async.eachSeries(data,function(item,callback){},function(err){})进行异步操作,function函数什么也没有做,只输出console.log(item)item,只输出了第一个,回调函数也不执行

阅读 4.2k
1 个回答

仔细看官网的例子:

async.everySeries(['file1','file2','file3'], function(filePath, callback) {
    fs.access(filePath, function(err) {   // 你有没有定义要执行的函数?
        callback(null, !err)   // 有没有指定回调函数?
    });
}, function(err, result) {
    // if result is true then every file exists
});
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题