getFile() method retrieves a file from your sandbox’s filesystem and returns it as a standard Web Response object, allowing you to handle the data in multiple formats: text, JSON, binary, or Blob.
All file paths must start with ~ or the absolute path /home/damner/code to ensure access is confined to the sandbox’s isolated workspace. If the requested file doesn’t exist or the path is invalid, an error is thrown.
getFile(path)
Description:
Retrieves a file from the sandbox filesystem. Returns a standard Response object that you can read as text, binary, blob, etc.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| path | string | Yes | File path (must start with ~ or /home/damner/code) |
Promise<Response> - Standard fetch Response object with methods:
.text()- Read as string.arrayBuffer()- Read as binary.blob()- Read as Blob.json()- Parse as JSON
