Skip to content

Instantly share code, notes, and snippets.

@retrohacker
Created June 15, 2014 19:01
Show Gist options
  • Save retrohacker/23aa3d7f14945fc4bcd9 to your computer and use it in GitHub Desktop.
Save retrohacker/23aa3d7f14945fc4bcd9 to your computer and use it in GitHub Desktop.
var wait = require('waitgroup')
var fs = require('fs')
var wg = new wait
var list = ['file1.txt','file2.txt','file3.txt','file4.txt']
list.forEach(function(val) {
wg.add()
fs.readFile(val,{"encoding":"UTF-8"},function(e,data) {
if(e) console.log(e)
else console.log(data)
wg.done()
})
})
wg.wait(function() {
console.log("All Open!")
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment