Snapshots
shard.snapshots.create
Section titled “shard.snapshots.create”Save a stopped sandbox’s files as a snapshot.
shard.snapshots.create(sandbox: SandboxRef, options?: { name?: string }): Promise<Snapshot>shard.snapshots.create(sandbox, *, name=None) -> SnapshotExamples
await web.stop();const base = await shard.snapshots.create(web, { name: "web-base" });const copy = await shard.create({ snapshot: "web-base", name: "web-2" });web.stop()base = shard.snapshots.create(web, name="web-base")copy = 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.
shard.snapshots.list
Section titled “shard.snapshots.list”List snapshots.
shard.snapshots.list(): Promise<Snapshot[]>shard.snapshots.list() -> list[Snapshot]Examples
for (const snapshot of await shard.snapshots.list()) console.log(snapshot.name, snapshot.image, snapshot.size);for snapshot in shard.snapshots.list(): print(snapshot.name, snapshot.image, snapshot.size)shard.snapshots.inspect
Section titled “shard.snapshots.inspect”Return one snapshot.
shard.snapshots.inspect(ref: string): Promise<Snapshot>shard.snapshots.inspect(ref) -> SnapshotExamples
const base = await shard.snapshots.inspect("web-base");base = 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.
shard.snapshots.remove
Section titled “shard.snapshots.remove”Delete a snapshot and its files.
shard.snapshots.remove(ref: string): Promise<void>shard.snapshots.remove(ref) -> NoneExamples
await shard.snapshots.remove("web-base");shard.snapshots.remove("web-base")Arguments
| Argument | Description |
|---|---|
ref |
snapshot ID or name |
Sandboxes created from the snapshot keep their own files.