OpenMetal
Guides

Work with files

Upload, download, list, and remove sandbox files without changing bytes.

Filesystem operations require a ready sandbox. Portable paths are absolute and cannot contain . or .. traversal segments.

const bytes = new TextEncoder().encode("hello from OpenMetal\n");

await metal.filesystem.upload(sandbox.id, "/workspace/input.txt", bytes, { createParents: true });

const downloaded = await metal.filesystem.download(sandbox.id, "/workspace/input.txt", {
  chunkSizeBytes: 1024 * 1024,
});

Low level operations

filesystem.read, write, list, and delete return queued runtime operations. Wait for completion with runtimeOperations.wait.

const queued = await metal.filesystem.write(sandbox.id, {
  path: "/workspace/data.bin",
  data: new Uint8Array([0, 255, 128]),
  mode: "overwrite",
  create_parents: true,
});

const completed = await metal.runtimeOperations.wait(queued);

Inspect an accepted operation later with its sandbox and runtime operation IDs:

const current = await metal.runtimeOperations.get(sandbox.id, queued.id);

Writes are limited to 10 MiB per operation. Reads use chunks up to 10 MiB and lists return at most 10,000 entries. Provider limits can be narrower.

Retry append carefully

Reuse the original idempotency key after an uncertain append. Retrying with a new key can duplicate bytes.

On this page