Skip to content

How are many files handled? #1

Closed
cadorn opened this Issue Mar 20, 2013 · 2 comments

2 participants

@cadorn
cadorn commented Mar 20, 2013

How are file changes detected by this library?

If you use FS.watchFile you will run out of file descriptors very quickly?

Is there any timestamp based comparisons using file mtime?

@jerfowler
Owner

Yes, the built-in watcher uses fs.watchFile exclusively, the same as chokidar. It does pass curr and prev stats objects used for mtime based comparisons.

http://nodejs.org/api/fs.html#fs_fs_watchfile_filename_options_listener

However, you don't have to use the built-in watcher. One could customize the watcher and use fs.watch instead, but there are numerous platform consistency issues with it.

Or you could build a custom watcher that kept a record of file & directory events from the walker and their stats. Then set its own interval to re-stat the recorded files/directories. It would be slower, but I suppose it could handle more files depending on available memory.

@jerfowler
Owner

Now has modular watcher support, so you can use watch instead of watchFile. Just pass module: 'watch' as an option. Or optionally create your own module and inject it.

@jerfowler jerfowler closed this Apr 13, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.