Skip to main content
Accessed via sandbox.files.

await sandbox.files.read(path)

Read a file as a UTF-8 string. HTTP API →
path
str
required
Absolute path to the file
Returns: str

await sandbox.files.read_bytes(path)

Read a file as raw bytes.
path
str
required
Absolute path to the file
Returns: bytes

await sandbox.files.write(path, content)

Write content to a file. HTTP API →
path
str
required
Absolute path for the destination file
content
str | bytes
required
File content
Returns: None

await sandbox.files.list(path="/")

List directory contents. HTTP API →
path
str
default:"/"
Directory path
Returns: list[EntryInfo]

await sandbox.files.make_dir(path)

Create a directory. HTTP API →
path
str
required
Directory path
Returns: None

await sandbox.files.remove(path)

Delete a file or directory. HTTP API →
path
str
required
Path to remove
Returns: None

await sandbox.files.exists(path)

Check if a path exists. Client-side wrapper — attempts a read and returns False on error.
path
str
required
Path to check
Returns: bool

Types

@dataclass
class EntryInfo:
    name: str
    is_dir: bool
    path: str
    size: int = 0