答案 0 :(得分:0)
查看异步库 http://caolan.github.io/async/docs.html#.each
async.each(openFiles, function(file, callback) {
// Perform operation on file here.
console.log('Processing file ' + file);
callback();
}, function(err) {
if(!err){
//because now my code will execute when for loop is done.
//code here will run only after loop is done
}
});