Created
December 12, 2010 20:27
-
-
Save billywhizz/738302 to your computer and use it in GitHub Desktop.
stress test for node-walk
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 walk = require("./lib/walk.js"); | |
var counter = 0; | |
var dirs = 0; | |
var files = 0; | |
var then = new Date().getTime(); | |
process.argv.forEach(function(val, index, array) { | |
if (index > 1) { | |
var walker = walk(val); | |
walker.on("directory", function (path, file, next) { | |
dirs++; | |
counter++; | |
//console.log(path); | |
next(); | |
}); | |
walker.on("file", function (path, file, next) { | |
files++; | |
counter++; | |
//console.log(path + "/" + file.name); | |
next(); | |
}); | |
walker.on("end", function() { | |
var now = new Date().getTime(); | |
console.log("time:" + ((now-then)/1000).toFixed(2) + ",total:" + counter + ",dirs:" + dirs + ",files:" + files); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment