The simplest possible directory walker
npm install fswalk
var walk = require('fswalk');
walk(__dirname, function(path, stats) {
console.log(path, stats);
}, function(err) {
assert(!err);
});
-
dir
: The directory to walk -
walkCb
:function(file, stats[, callback])
The function to be called with each file. -
file
: Relative file path
-
stats
: fs.Stats object
-
callback
: If given, any errors will be propagated tofinishCb
and the walk will stop soon.walkCb
is called in parallel for some files, so the walk will stop at the current folder.finishCb
will not be called until allwalkCb
callbacks have been called.
-
finishCb
:function(err)
Called when all files have been walked. -
limit
: Max depth,undefined
means no limit