Inist-CNRS / node-inotifywait

Yet another nodejs fs.watch/inotify implementation. Good for large directory structure with lot of files.
MIT License
23 stars 8 forks source link

'add' and 'unlink' events not triggering with folders #11

Open HRK44 opened 5 years ago

HRK44 commented 5 years ago

Ubuntu 18.04.1

The add event is not triggering on folder creating, same for unlink.

    let rootWatcher = new INotifyWait(dir, {
        recursive: true
    });

    rootWatcher.on('ready', () => console.log('watching now...'));
    rootWatcher.on('add', (filename, stats) => console.log('new file created : ' + filename));
    rootWatcher.on('unknown', filename => console.log('unknown event...'));
    rootWatcher.on('unlink', filename => {
        console.log('deleted file : ' + filename);
        // rootWatcher.close();
    });
HRK44 commented 5 years ago

Never mind, there is the option watchDirectory that you have to set to true for this to happen. Not mentioned anywhere on the README.md