Last active
August 29, 2015 14:08
-
-
Save vishakvkt/8e359265d1641197b61f to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Future = require('fibers/future'); | |
var fs_f = Future.wrap(require('fs')); | |
if(process.argv.length < 3) { | |
console.log("format filestat <path>"); | |
process.exit(); | |
} | |
function processFileStats(stat) { | |
console.log(stat); | |
} | |
var path = process.argv[2]; | |
Future.task(function() { | |
var directoryContents = fs_f.readdirFuture(path).wait(); | |
var fileStats = []; | |
for(var i =0; i < directoryContents.length; i++) { | |
var fileStat = fs_f.statFuture(path + "\\" + directoryContents[i]).wait(); | |
fileStats.push(fileStat); | |
} | |
for(var j = 0; j < fileStats.length; j++) { | |
processFileStats(fileStats[j]); | |
} | |
}).detach(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment