---
title: "readfile"
description: "Reads a workspace file as a binary-safe string."
---

```lua
readfile(path: string): string
```

---

## Aliases

None.

---

## Arguments

<ParamField body="path" type="string" required>
  A UTF-8 path relative to the Byte workspace.
</ParamField>

---

## Returns

<ResponseField name="data" type="string">
  The file bytes.
</ResponseField>

Missing files or directories raise an error. Paths are relative to the workspace.

**Related types:** [Filesystem types & behavior](/reference/filesystem/types).

---

## Example

```lua
writefile("docs-example/read.txt", "hello")
print(readfile("docs-example/read.txt"))
```
