---
related_nodes: [relay_request]
---

# Relay Filesystem

Run filesystem operations against a named Verdalia Relay mount.

## Configuration

**connection** — Verdalia Relay connection: pick one, or write a template such as
`{{ input.connection_id }}` that resolves to a connection id from `input` on each run. The node
fails, naming the template and what it resolved to, when the input has no value for it, the value
is not a connection id, no Verdalia Relay connection has that id, or that relay is offline.

**mount** — Mounted filesystem name configured in the Relay.

**operation** — Operation to run:

- `list`
- `stat`
- `read_file`
- `write_file`
- `append_file`
- `edit_file`
- `create_directory`
- `move_path`
- `delete_path`
- `grep`
- `download_library_item`

Paths are relative to the selected mount. Content, edit text, grep pattern and Library item
support interpolation from `input`.

### Download Library Item

Writes the file a Library item holds to a path on the mount. The Relay fetches the file from
storage itself, however large, and the step waits until it is done.

- **library_item** — a Library item's id or slug, or a stored file a Library item owns, such as
  the output of a download step saved to the Library (`{{ input }}`) or its `object_id`.
- **path** — destination, relative to the mount.
- **overwrite** — replace what is at the destination. Off: whatever is there is kept, even
  something created during the download, and the step fails.
- **create_parents** — create missing parent folders.

Verdalia gives the Relay a link to the file that is valid for 15 minutes; a download that takes
longer still completes. The link never appears in the step's output or in logs. The Relay writes
to a hidden file beside the destination and gives it the destination's name only once its size
and SHA-256 match the item's; on any failure the destination is untouched.

The step fails, naming the cause, when:

- the item is in the trash, holds no file (a document or folder), or the stored file belongs to
  something other than a Library item;
- the file is not available or has no recorded SHA-256;
- this deployment's storage cannot hand a file to a Relay;
- the mount is read-only, the path is outside the mount or is a folder, a parent is missing
  without `create_parents`, or the destination exists without `overwrite`;
- the Relay is too old to download Library items (update it), or already runs 4 downloads;
- storage refuses or stops sending, the bytes do not match the item's size or SHA-256, or the
  Relay cannot write the file;
- the Relay restarts during the download, or cannot be reached for two minutes, in which case
  the outcome is unknown;
- the step is cancelled or times out; the Relay is asked to stop the download.

Output `result`: `{"path": "...", "size_bytes": 495773445, "sha256": "..."}`, checked equal to
the item's.

## Inputs

**input** — JSON value used as interpolation context.

## Output

**output**

```json
{
  "operation": "read_file",
  "mount": "workspace",
  "success": true,
  "result": {}
}
```

Relay errors fail the node.
