Chokidar: "add" events on startup

Created on 29 Aug 2017  路  2Comments  路  Source: paulmillr/chokidar

When I start chokidar.watch, I get an _add_ event for every file in the directory I'm watching.

let watcher = chokidar.watch ("/path/to/folder/");

The files haven't been modified, or newly added. They were there the last time chockidar.watch was watching.

Why are these add events being sent? Is there any way to tell chokidar to only send an add when a file is actually added to the directory.

Also, thanks for a great utility, it's made it possible to make some very useful tools. ;-)

Most helpful comment

Those events allow apps to know what's being watched at the outset. You can suppress them with the ignoreInitial: true option.

All 2 comments

Those events allow apps to know what's being watched at the outset. You can suppress them with the ignoreInitial: true option.

Thank you. I see the docs are here, in case anyone comes through here looking for the answer. ;-)

Was this page helpful?
0 / 5 - 0 ratings