2011-05-03 03:11:03 +00:00
|
|
|
(function () {
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var walk = require('./lib/walk')
|
|
|
|
, fs = require('fs')
|
2013-06-23 05:58:50 +00:00
|
|
|
, options
|
|
|
|
, walker
|
|
|
|
;
|
|
|
|
|
|
|
|
options = {
|
|
|
|
listeners: {
|
|
|
|
names: function (root, nodeNamesArray) {
|
|
|
|
nodeNamesArray.sort(function (a, b) {
|
|
|
|
if (a > b) return 1;
|
|
|
|
if (a < b) return -1;
|
|
|
|
return 0;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
, directories: function (root, dirStatsArray, next) {
|
|
|
|
// dirStatsArray is an array of `stat` objects with the additional attributes
|
|
|
|
// * type
|
|
|
|
// * error
|
|
|
|
// * name
|
|
|
|
|
|
|
|
next();
|
|
|
|
}
|
|
|
|
, file: function (root, fileStats, next) {
|
|
|
|
fs.readFile(fileStats.name, function () {
|
|
|
|
// doStuff
|
|
|
|
console.log(root, fileStats.name);
|
|
|
|
next();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
, errors: function (root, nodeStatsArray, next) {
|
|
|
|
next();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
walker = walk.walkSync("/tmp", options);
|
|
|
|
|
|
|
|
console.log("all done");
|
2011-05-03 03:11:03 +00:00
|
|
|
}());
|