Skip to content

Commit

Permalink
Apply filters to new files
Browse files Browse the repository at this point in the history
  • Loading branch information
paton committed Sep 10, 2014
1 parent 55e1870 commit b037f47
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions main.js
Expand Up @@ -84,6 +84,7 @@ exports.watchTree = function ( root, options, callback ) {
var file = path.join(f, b);
if (!files[file] && (options.ignoreDotFiles !== true || b[0] != '.')) {
fs.stat(file, function (err, stat) {
if (options.filter && !options.filter(file, stat)) return;
callback(file, stat, null);
files[file] = stat;
fileWatcher(file);
Expand Down
2 changes: 1 addition & 1 deletion readme.mkd
Expand Up @@ -17,7 +17,7 @@ The first argument is the directory root you want to watch.
The options object is passed to fs.watchFile but can also be used to provide two additional watchTree specific options:

* `'ignoreDotFiles'` - When true this option means that when the file tree is walked it will ignore files that being with "."
* `'filter'` - You can use this option to provide a function that returns true or false for each file and directory that is walked to decide whether or not that file/directory is included in the watcher.
* `'filter'` - You can use this option to provide a function that returns true or false for each file and directory to decide whether or not that file/directory is included in the watcher.
* `'ignoreUnreadableDir'` - When true, this options means that when a file can't be read, this file is silently skipped.
* `'ignoreDirectoryPattern'` - When a regex pattern is set, e.g. /node_modules/, these directories are silently skipped.

Expand Down

0 comments on commit b037f47

Please sign in to comment.