When I use "add" event for watching a folder with Chokidar all existing files are listed as added.
Is this the correct behavior?
How can I prevent existing files from being listed and only show files that gets added?
The "change" event works as expected.
var watcher = chokidar.watch('/My/path', {
ignored: /[\/\\]\./,
persistent: true
});
watcher
.on('change', function(path) { console.log("File " + path + " has been changed"); })
.on('add', function(path) { console.log("File " + path + " has been added"); });
I'm using [email protected]
/Christian
Try using the ignoreInitial
option:
const watcher = chokidar.watch(DIR_PATH, {
ignoreInitial:true
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With