walk through directory trees and apply an action on every file (synchronous dive)
diveSync is a tiny module for node that is able to recursively walk (_„dive“_) a directory tree. diveSync is the synchronous version of dive.
var diveSync = require"diveSync";diveSyncprocesscwdif err throw err;console.logfile;;
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.
divedir opt action;
The default options are
recursive: true // - If set to false, this will ignore subdirectories.all: false // - If set to true, this will show "dot files" and// files in "dot directories", e.g. ".gitinore" or// ".git/HEAD".directories: false // - If set to true, this will show directories, too.filter: return true;// - Function that returns true for all paths that should// not be ignored.
filter takes two arguments
path defines the path to file in
the file system.
path is a directory, otherwise
You can use this to filter out specific files or directories by their pathname.