Declaw icon

Declaw

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

File → Write Batch

AI-generated

Summary

Writes several text files into an existing Declaw sandbox in one API call, from a JSON array of {path, data} entries.

Inputs

  • Sandbox ID (required) — ID of the target sandbox (e.g. sbx-a1b2c3d4). It is inserted into the request URL.
  • Files (JSON) (required) — JSON array of file objects, each with "path" (absolute path in the sandbox) and "data" (text content). The node parses it and rejects invalid JSON, or JSON that isn't an object or array, with an error. It does not check that each entry has path and data. Expressions can be used to build the array dynamically.

Output shape

One output item per input item, containing the JSON response from the Declaw API's batch file-write endpoint (POST /sandboxes/{id}/files/batch).

The exact response fields are not defined in the node source. If the API call fails, the node throws, or with Continue On Fail it emits an item with {error: message}. The node does not check entries for path/data before sending; the API validates them. Existing files at the same paths are presumably overwritten, but the source doesn't confirm this.

Examples

Example 1: Seed a sandbox with two Python scripts before running a command

Sandbox ID = {{$json.sandbox_id}}; Files (JSON) = [{"path":"/home/user/a.py","data":"x = 1"},{"path":"/home/user/b.py","data":"y = 2"}]

Example 2: Upload dynamically generated config files

Sandbox ID from an earlier Create node; Files (JSON) set via an expression such as {{ JSON.stringify($json.files) }}

Links

Discussion