Skip to content

Scans

Events published when indexed locations change or go offline, and while a directory scan runs and completes.

Subscribe over HTTP SSE by sending {"events":["locations.changed","scan.*"]} to POST /api/v1/events, or use curio.on(...) below. See Subscribe to the event stream for stream filtering, heartbeats, replay windows and reconnection.

locations.changed

Permission: metadata.read Invalidation signal Wildcard: locations.*

Emitted when a location is added, removed, relocated, updated (setAccess or setLook), finishes a scan or switches between online and offline. Payload is {}. Call location.list to refresh.

curio.on('locations.changed', async () => {
  const locs = await curio.location.list()
  console.log(locs.map((l) => `${l.name}: ${l.online ? 'online' : 'offline'}`))
})

Observed event

{ "id": "1763941400000-a1b2c3d4-30", "name": "locations.changed", "library": "c4b8f1d2-...", "at": 1763941400000, "data": {} }

scan.progress

Permission: library.read Throttled ~1/sec Wildcard: scan.*

Emitted once when a location scan starts (files: 0) and roughly once per second while walking the directory tree.

Payload ({ location: number; files: number })

Field Type Description
location number Numeric location ID being scanned.
files number Number of files visited so far.
curio.on('scan.progress', (ev) => {
  console.log(`Location ${ev.data.location}: ${ev.data.files} files seen`)
})

Observed event

{
  "id": "1763941401100-a1b2c3d4-31",
  "name": "scan.progress",
  "library": "c4b8f1d2-...",
  "at": 1763941401100,
  "data": { "location": 2, "files": 1240 }
}

scan.done

Permission: library.read Scope: Library Wildcard: scan.*

Emitted when a location scan completes with a summary of discovered changes.

Payload ({ location: number; files: number; added: number; changed: number; moved: number; missing: number; offline: number })

Field Type Description
location number Location ID.
files number Total files seen during the scan.
added number Newly indexed items.
changed number Existing items whose file size or modification time changed.
moved number Existing items matched at a new path within the location.
missing number Items marked Missing because their file disappeared.
offline number Items marked Storage offline.
curio.on('scan.done', (ev) => console.log('Scan finished:', ev.data))

Observed event

{
  "id": "1763941405900-a1b2c3d4-32",
  "name": "scan.done",
  "library": "c4b8f1d2-...",
  "at": 1763941405900,
  "data": { "location": 2, "files": 1520, "added": 14, "changed": 2, "moved": 1, "missing": 0, "offline": 0 }
}