Skip to main content

Snapshots & restore

Snapshots are created/restored by the LioranManager.

manager.snapshot(snapshotPath)

Creates a tar.gz archive of the manager root directory.

Important details:

  • Not allowed in readonly mode.
  • In IPC client mode, the snapshot runs in the primary process.
  • Open DBs are closed before the snapshot is created (to avoid partial state).
import { LioranManager } from "@liorandb/core";

const manager = new LioranManager({ rootPath: "./.liorandb" });
await manager.db("app");

const ok = await manager.snapshot("./backups/app.tar.gz");
console.log(ok);

await manager.close();
Sandbox output (example)
true

manager.restore(snapshotPath)

Restores a snapshot archive into the manager root directory.

Important behavior:

  • The root directory is removed and recreated.
  • After restore completes, the process prints "Restore completed. Restart required." and exits.
import { LioranManager } from "@liorandb/core";

const manager = new LioranManager({ rootPath: "./.liorandb" });
await manager.restore("./backups/app.tar.gz");
Sandbox output (example)
Restore completed. Restart required.