readdirSyncRecursive: add a filter argument

filter is an optional filter function that will be applied on the records of
each sub-directory to keep only the records you need. Avoiding redundencies
is critical for big folders trees
This commit is contained in:
Daniel Chcouri 2014-05-13 11:08:54 +03:00
parent 13f486d867
commit cd1f107279
3 changed files with 30 additions and 2 deletions

View file

@ -54,6 +54,9 @@ wrench.rmdirSyncRecursive('my_directory_name', failSilently);
// Recursively read directories contents.
wrench.readdirSyncRecursive('my_directory_name');
// Recursively read directories contents, filter results (efficient memory usage for big folders trees).
wrench.readdirSyncRecursive('my_directory_name', function (x) { return /\.txt$/.test(x); });
// Recursively chmod the entire sub-tree of a directory
wrench.chmodSyncRecursive('my_directory_name', 0755);