Watching Directories
One way fseventsd reduces the amount of data it, and other applications, have to slog through is by only reporting file system changes on a per-directory basis. If the user adds a file to ~/blah/, modifies a file in there, and deletes another file, you’ll only get one “hey, ~/blah/ changed” notification. It is up to you to decide what to do in that case. In order to figure out which file changed, you will need to have a cached copy of the contents of the directories and then compare. If you are implementing something like drop boxes, where putting a file in a directory causes some action to happen, you can just scan the directory for new files.
You can choose which directory hierarchies to watch, and you can choose whether ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access