# GET /files/read

Read a page of a file and its current hash.

This is a device HTTP route. Set `DEVICE_URL` to your reachable device URL; [connection and examples](https://mcp.applesauceos.com/doc/http.md) explain how. Do not append this path to the public MCP URL.

## Parameters

| Parameter | Type | Meaning |
| --- | --- | --- |
| `path` | query string | Required relative file path. |
| `encoding` | query string | utf8 (default) or base64. |
| `offset` | query string | Byte offset 0..8388608; default 0; cannot exceed file size. |
| `maxBytes` | query string | 1..524288; default 262144. |

## Response

JSON {path,content,encoding,bytes,sha256,offset,truncated,nextOffset}. bytes is the total file size.

## Example

```sh
curl --fail-with-body "$DEVICE_URL/files/read?path=Demo.cso/main.js"
```

## Notes

Files are limited to 8 MiB. Follow nextOffset rather than a character count. Use base64 for binary data or offsets that split a UTF-8 character.

Paths are relative to Scripts. Absolute paths, parent traversal and symlink traversal are rejected. [File rules](https://mcp.applesauceos.com/doc/http-guide.md#files-and-project-directories) apply to every file endpoint.

Check the HTTP status and any JSON error. [HTTP workflows and error handling](https://mcp.applesauceos.com/doc/http-guide.md) explain shared limits. [All endpoints](https://mcp.applesauceos.com/doc/http.md).
