sandbox.files to move data in and out of a sandbox. The SDK handles data-plane routing and authentication transparently.
Using
AsyncSandbox? The same files methods are there, awaitable.Write binary content
write() accepts strings or raw bytes. Parent directories are created automatically.
Read as bytes or text
read()returns raw bytes (Uint8Arrayin TypeScript,bytesin Python)readText()/read_text()returns a UTF-8-decoded string
Download a directory as a zip
downloadDir() / download_dir() exports a whole directory as a ZIP archive —
useful for pulling out logs, build artifacts, or results in one call. It returns
the raw zip bytes; large directories can exceed the default 30s timeout, so pass
a longer timeoutMs / timeout when needed.
Path rules
Paths passed tofiles.* methods must:
- Start with
/- only absolute paths are accepted - Contain no
..segments - no traversal
mkdir -p first.