Watches a file or directory for changes.
Recursively monitors subdirectories by default. The returned monitor is kept alive internally to prevent garbage collection.
The file or directory path to monitor
Optional
Callback invoked on file changes
Monitor flags and recursion setting
The file monitor, or null on error
null
monitorFile('/tmp/myfile', (file, event) => { console.log('changed:', file.get_path(), event);}); Copy
monitorFile('/tmp/myfile', (file, event) => { console.log('changed:', file.get_path(), event);});
Watches a file or directory for changes.
Recursively monitors subdirectories by default. The returned monitor is kept alive internally to prevent garbage collection.