Skip to main content
Connect your VFS to a notification service using Push or Poll. See the overview for listening to changes and event types.

Push

Receive file changes through webhooks, streams or external file watchers. Convert them with the functions below, then call ws.notify() for each change. See the Python and TypeScript examples.

Push examples

The S3 and GitHub examples process a saved payload; they do not start a webhook server. Run from the repository root after installing the language’s dependencies:
The Disk example creates, updates and deletes temporary local files, then reports those changes directly to Mirage. It prints:
Disk output
For S3, a saved ObjectCreated:Put notification for report.csv in your configured bucket produces:
S3 output

Poll

Fetch changed files from the service, on a schedule or after a notification. Create hook with vfs.delta_hook() (Python) or vfs.deltaHook() (TypeScript). Call await hook.pull(root, checkpoint), send each item in result.changes to ws.notify(), and save result.checkpoint for the next call. See the Python and TypeScript examples. For other VFS types, your application can detect changes and report them directly with ws.notify().

Poll examples

Dropbox waits for a long-poll notification. Box and Google Drive check every five seconds. Start an example, then edit files in that service to see their virtual paths. Press Ctrl-C to stop. Each run starts from the current state.
For example, start the Box example, then upload a new report.csv to the root folder in Box:
Example output