> ## Documentation Index
> Fetch the complete documentation index at: https://docsuncv2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# readfile

Returns the full contents of the file at `path` as a single string.

```luau theme={null}
readfile(path: string): string
```

`path` is workspace-relative. There's no encoding step - you get the exact bytes that are on disk, so binary files read fine too.

## Parameters

| Parameter | Type     | Description   |
| --------- | -------- | ------------- |
| `path`    | `string` | File to read. |

## Returns

`string` - raw contents of the file. The string can contain any byte value, including embedded `"\0"` and binary data.

## Example

Load a saved config back into a Lua table:

<CodeGroup>
  ```luau Example 1 theme={null}
  <<<<<<< HEAD
  local content = readfile("hello.txt")
  =======
  -- readfile(path: string): string
  >>>>>>> 50e30f53759b0538759af25c9b271514aa2c9290
  ```

  ```luau Example 2 theme={null}
  local HttpService = game:GetService("HttpService")

  local raw = readfile("autofarm/config.json")
  local config = HttpService:JSONDecode(raw)

  -- assuming you came from writefile doc page
  print(config.option3) --> 3735928559
  ```
</CodeGroup>

<Tip>
  Always check `isfile()` before reading to avoid runtime errors.
</Tip>
