Currently I am using chokidar to watch a directory. The directory has a large amount of files, and it is constantly being written too. I am also using polling because I need to watch folders on a network. I noticed that when I start watching the directory, my CPU usage is really high.
From what I understand, watchers are also being created for each file in the directory?
I only need to be notified if a file has been added, I don't need to monitor for any changes to the file itself. So I feel like there is a lot of overhead being created for what I need. Is this possible with chokidar in any way? Or should I look for another solution for these needs.
Updated: Added a snippet of how I am creating my watcher instance. I'm not really doing anything special. I noticed that the CPU usage spikes really high as soon I create the watcher. The directory has about 20k files in it.
var fileWatcher = chokidar.watch('path to directory', {
ignored: '*.txt',
ignoreInitial: true,
usePolling: true,
interval: 600,
depth: 0});
fileWatcher.on('add', function(path) {
//Do something when a new file is created in the watched directory
});