Read a file from the sandbox.
read(path: string, timeout: number = 60): Promise<Uint8Array<ArrayBufferLike>>| Name | Type | Description |
|---|---|---|
path* | string | File path to read. Supports both absolute paths (e.g., /tmp/file.txt) and relative paths (resolved from /home/user/). |
timeout | number | Default: 60Request timeout in seconds. |
const content = await sandbox.read("/tmp/output.txt");
const text = new TextDecoder().decode(content);
console.log(text);