You can use the files.watchDir() method in JavaScript and the files.watch_dir() method in Python to watch a directory for changes.
Since events are tracked asynchronously, their delivery may be delayed.
It’s recommended not to collect or close watcher immediately after making a change.
You can set the recursive parameter to enable recursive watching.
When rapidly creating new folders (e.g., deeply nested path of folders), events other than CREATE might not be emitted. To avoid this behavior, create the required folder structure in advance.