DirectoryWatcher
Summary
Defines a directory watcher to watch for changes inside a directory and its sub directories.
Constructor
Item Index
Methods
Properties
Methods
close
Syntax
close
-
[directoryPath]
Summary
Stops watching the directory and all its sub directories.
Parameters:
-
[directoryPath]
String optionalAbsolute path of the directory to stop watching. If not specified the directory and all its sub directories won't be watched anymore
createWatcher
Syntax
createWatcher
-
directoryPath
-
callback
Summary
Creates a watcher on the given directory.
isWatched
Syntax
Summary
Checks if a sub directory is actually being watched.
Parameters:
-
directoryPath
StringThe absolute path of the directory to check
Returns:
true if directory is actually being watched, false otherwise
watch
Syntax
watch
-
callback
Summary
Watches a directory and all its sub directories.
Parameters:
-
callback
FunctionThe function to call when its done
- Error An error if something went wrong
Properties
fsWatchers
Syntax
Summary
List of watchers for this directory and its sub directories.
Events
create
Syntax
create
Summary
Fired when a new resource (file or directory) has been added to the watched folder.
Event Payload:
-
Path
Stringof the added resource
delete
Syntax
delete
Summary
Fired when a resource (file or directory) has been deleted from the watched folder.
Event Payload:
-
Path
Stringof the resource before it has been removed
watch
Syntax
watch
Summary
Fired when a directory is added to the watched directory.
Fired after "create" event in case the directory is added to the watched directory.
Event Payload:
-
Path
Stringof the directory