The Sync API provides functions for interacting with the sync engine when the client runs in Sync mode.

sync.hasInitialSyncCompleted

sync.hasInitialSyncCompleted()

Checks whether the initial client synchronization has completed.

Returns:

  • boolean — Whether initial sync is complete.

sync.performFileSync

sync.performFileSync(path)

Prioritizes a file for immediate synchronization and waits for completion.

Parameters:

  • path (string) — Space-relative file path.

Example:

sync.performFileSync("notes/important.md")

sync.performSpaceSync

sync.performSpaceSync()

Starts an immediate full-space synchronization and waits for completion.

Returns:

  • number — Number of sync operations, or zero without an active worker.

Example:

local changes = sync.performSpaceSync()