Declaw icon

Declaw

Run code securely in Firecracker microVM sandboxes — create sandboxes, execute commands, manage files

File → Read

AI-generated

Summary

Reads a text file from a Declaw sandbox by absolute path and returns the API response as the item's JSON output.

Inputs

  • Sandbox ID (required) — ID of the existing sandbox to read from (e.g. sbx-a1b2c3d4).
  • File Path (required) — Absolute path of the file inside the sandbox (e.g. /home/user/output.txt). Sent as the path query parameter.

Output shape

One output item per input item, built from the API response to GET /sandboxes/{sandboxId}/files?path=... The response is passed through n8n's returnJsonArray, so an object becomes the item's JSON and an array becomes multiple items.

The source doesn't show the exact response schema. In the Code resource, the same endpoint's response is handled as either a plain string or an object. Plain-string content may therefore be wrapped by n8n's JSON handling. For images, archives or other binary files, use Read Binary instead. If the call fails (e.g. the file is missing), the node throws an error unless Continue On Fail is on. In that case it outputs {error: message} for that item.

Examples

Example 1: Fetch a result file produced by an earlier command step.

Resource: File, Operation: Read, Sandbox ID: {{$json.sandbox_id}}, File Path: /home/user/result.json

Example 2: Read a script's log output after a background command.

Resource: File, Operation: Read, Sandbox ID: sbx-a1b2c3d4, File Path: /home/user/app.log

Links

Discussion