Skip to content

Save a stopped sandbox’s files as a snapshot.

shard.snapshots.create(sandbox: SandboxRef, options?: { name?: string }): Promise<Snapshot>

Examples

await web.stop();
const base = await shard.snapshots.create(web, { name: "web-base" });
const copy = await shard.create({ snapshot: "web-base", name: "web-2" });

Arguments

Argument Description
sandbox source sandbox, as a Sandbox or its ID, ID prefix or name

Options

TypeScript Python Description
name name snapshot name to use instead of its ID

Stop the sandbox first. Snapshots contain files, not memory or process state. They remain available after the source sandbox is removed. A provider without snapshots raises UnsupportedError.

To start a sandbox from one, pass snapshot to shard.create. The rules for that create are in the CLI reference.

List snapshots.

shard.snapshots.list(): Promise<Snapshot[]>

Examples

for (const snapshot of await shard.snapshots.list()) console.log(snapshot.name, snapshot.image, snapshot.size);

Return one snapshot.

shard.snapshots.inspect(ref: string): Promise<Snapshot>

Examples

const base = await shard.snapshots.inspect("web-base");

Arguments

Argument Description
ref snapshot ID or name

A Snapshot holds id, name, the source sandbox’s ID and name, image, digest, provider, the disk and memory bounds the source ran under, size, the bytes it takes on the host, and the creation time.

Delete a snapshot and its files.

shard.snapshots.remove(ref: string): Promise<void>

Examples

await shard.snapshots.remove("web-base");

Arguments

Argument Description
ref snapshot ID or name

Sandboxes created from the snapshot keep their own files.