WatchHandle that you stop with stop().
Event object & event types
Each filesystem event is aFilesystemEvent with two fields:
The
type is one of the FilesystemEventType values:
Watch a directory (JavaScript / TypeScript)
watchDir(path, onEvent, opts?) starts watching and invokes onEvent for each event. It returns a WatchHandle; call stop() to stop watching.
JavaScript & TypeScript
Watch a directory (Python)
The Python sync SDK uses a polling model:watch_dir(path, recursive=False) returns a WatchHandle, and you call get_new_events() to pull the events that occurred since the last call. Stop with stop().
Python
on_event callback to watch_dir, which returns an AsyncWatchHandle. Stop with await handle.stop().
Python
Note: Recursive watching (
recursive=True) requires an up-to-date template. If the template is too old, the SDK raises a template error asking you to rebuild it with novita-sandbox-cli template build.