# fs.file.get

Read the content of the file --from names — a FileRef, an upload or a store key

# fs.file.get

```
fs.file.get --from FILE [--encoding text|base64] [--return inline|file] [--store TEXT] → file
```

Read the content of the file `--from` names — a FileRef, an upload or a store key. `--encoding text` (default) puts UTF-8 in `file.content`; `--encoding base64` puts the bytes in `file.base64`. Adds `file: { path, size, modified, kind, content_type, content, base64 }` and keeps the rest of the payload. A binary file read as text fails with FW_NODE_FS_FILE_GET_UTF8; use base64. `--return file` reads nothing into the run: `file` is the file's durable FileRef (digested by streaming), what `web.response.send --file "{{ input.file }}"` streams to the caller.

## Flags

- `--from` (required): The file: a FileRef, an upload or a store key.
- `--encoding`: text (default) or base64.
- `--return`: inline (default) puts the content in `file`; file answers the file's FileRef and reads no bytes into the run. Literal.
- `--store`: The store a bare key is read from: `local`, or the id of an `s3` credential; a FileRef is read from its own store. Saved explicitly when the pipeline is registered.

## Examples

### Read a text file

```
| fs.file.get --from docs/notes.md
```

It answers:

```json
{
  "file": {
    "path": "docs/notes.md",
    "size": 42,
    "modified": "2026-09-13T04:00:00Z",
    "kind": "object",
    "content_type": "text/plain; charset=utf-8",
    "content": "# Notes\n…",
    "base64": null
  }
}
```

### Hand a stored file to the response

```
| fs.file.get --from reports/a1.pdf --return file
```

Then `web.response.send --file "{{ input.file }}"` streams it, with Range, HEAD and 304.

It answers:

```json
{
  "file": {
    "__zf_type": "file_ref",
    "backend": "zebfs",
    "store": "local",
    "ref": "reports/a1.pdf",
    "filename": "a1.pdf",
    "mime": "application/pdf",
    "kind": "pdf",
    "size": 52311,
    "sha256": "sha256:…",
    "lifecycle": "durable",
    "origin": "fs.file.get",
    "trust": "generated"
  }
}
```
