Skip to main content
The 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 the absolute path /home/damner to ensure access is confined to the sandbox’s isolated workspace.

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:
ParameterTypeRequiredDescription
pathstringYesFile path (must start with /home/damner)
Returns: Promise<Response> - Standard fetch Response object with methods:
  • .text() - Read as string
  • .arrayBuffer() - Read as binary
  • .blob() - Read as Blob
  • .json() - Parse as JSON
Example:
// Read text file
const response = await sandbox.getFile('/home/damner/script.js')
const content = await response.text()
console.log(content)