Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.superserve.ai/llms.txt

Use this file to discover all available pages before exploring further.

Use sandbox.files to move data in and out of a sandbox. The SDK handles data-plane routing and authentication transparently.
await sandbox.files.write("/app/config.json", '{"key": "value"}')

const text = await sandbox.files.readText("/app/config.json")
console.log(text)
AsyncSandbox exposes the same files API with awaitable methods.

Write binary content

write() accepts strings or raw bytes. Parent directories are created automatically.
import { readFileSync } from "node:fs"

const buffer = readFileSync("./local-image.png")
await sandbox.files.write("/app/image.png", buffer)

await sandbox.files.write("/app/data.bin", new Uint8Array([1, 2, 3, 4]))

Read as bytes or text

  • read() returns raw bytes (Uint8Array in TypeScript, bytes in Python)
  • readText() / read_text() returns a UTF-8-decoded string
const bytes: Uint8Array = await sandbox.files.read("/app/image.png")

const text: string = await sandbox.files.readText("/app/config.json")

Path rules

Paths passed to files.* methods must:
  • Start with / - only absolute paths are accepted
  • Contain no .. segments - no traversal
Parent directories are created automatically on write - you don’t need to mkdir -p first.

Errors

See the files reference and the full error hierarchy.