Created
November 25, 2015 16:29
-
-
Save kolombet/731b140122216b24160c to your computer and use it in GitHub Desktop.
LUKE FILEWALKER
resursivly scan directory and create output
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 walk = require('walk'); | |
var files = []; | |
// Walker options | |
var walker = walk.walk('./', { followLinks: false }); | |
var fs = require('fs'); | |
walker.on('file', function(root, stat, next) { | |
files.push(stat.name); | |
next(); | |
}); | |
walker.on('end', function() { | |
var outputFilename = 'files.json'; | |
fs.writeFile(outputFilename, JSON.stringify(files, null, 4), function(err) { | |
if(err) { | |
console.log(err); | |
} else { | |
console.log("JSON saved to " + outputFilename); | |
} | |
}); | |
}); | |
var rand = function() | |
{ | |
return Math.floor(Math.random() * 1000); | |
} | |
//{ | |
// "id": 10, | |
// "type": "helm", | |
// "sex": "male", | |
// "price": 100, | |
// "levelRequirement": 0, | |
// "action": "moneyMulti", | |
// "actionParam": 10, | |
// "picture": "content/equipment/-$--player-set-sets-set_02-male_helm_57.swf" | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment