List & inspect snapshots
listSnapshots() and snapshotExists().
listSnapshots() → Promise<SnapshotRecord[]>
Returns every snapshot on the host.
import { listSnapshots } from "@beamhop/lightbox";
for (const s of await listSnapshots()) {
console.log(s.name, s.imageRef, s.sizeBytes, s.createdAt);
}
SnapshotRecord
interface SnapshotRecord {
name: string | null; // null for snapshots stored by digest only
digest: string;
imageRef: string;
createdAt: Date;
sizeBytes: bigint | null;
path: string; // absolute path on the host filesystem
}
snapshotExists(name) → Promise<boolean>
Convenience around listSnapshots() — useful if you’re about to build conditionally.
import { snapshotExists, buildSnapshot } from "@beamhop/lightbox";
if (!(await snapshotExists("rust-ci"))) {
await buildSnapshot({ name: "rust-ci", image: "rust:1.82" });
}
(You usually don’t need this — buildSnapshot is idempotent by default and overwrites collisions for you.)