Created
June 15, 2014 19:01
-
-
Save retrohacker/23aa3d7f14945fc4bcd9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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