Watches a path, whether the path is a file or a directory containing many files. Doesn't care whether the path exists or not, whether it disappears and reappears, etc.
constructor
Events
A child file has been added to the target directory. Also emitted with no filename
argument
when the target path appears, whether it is a directory or file. You can use the isFile
property if you need to know more about the target path.
A child file has been modified within the target directory. This event is batched with a
configurable
timeout. When the target path is a file, changes
to the target file cause change
to be emitted with no filename
argument.
The initial readiness state has been reached. Emitted after one tick when a file or missing path is targeted. If a directory is found, initial readiness is delayed until watches have been established on the directory's children.
A child file has been removed from the target directory. Also emitted with no filename
argument when the target path disappears, whether it was a directory or file.
Member Properties
Whether the watched path currently exists. This value is considered up-to-date during event listener execution.
Methods
Terminates all file watching activities and closes the native file watches. No more events will
be emitted. This Spy
cannot be recovered once closed.