diveSync is a tiny module for node that is able to recursively walk („dive“) a directory tree. diveSync is the synchronous version of dive.
Usage
var diveSync = require("diveSync");
diveSync(process.cwd(), function(err, file) {
if (err) throw err;
console.log(file);
});
This will list all files in your current working directory. The function call blocks until all files are handled.
You may also apply options to the function call.
dive(dir[, opt], action);
The default options are
{
recursive: true,
all: false,
directories: false
filter: function filter(path, dir) { return true; }
}
filter takes two arguments (path, dir). path defines the path to file in
the file system. dir is true, if path is a directory, otherwise false.
You can use this to filter out specific files or directories by their pathname.