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

# readfile

> Liest ein existing regular file innerhalb des workspace im binary mode und gibt seine bytes als Lua string zurueck.

<div className="real-function-page">
  ```lua theme={null}
  readfile(path: string): string
  ```

  ## Aliase

  * `readfileasync`

  ## Argumente

  <ParamField path={"path"} type={"string"} required>
    File path, der nach separator normalization, workspace-boundary checks und filename/extension checks innerhalb des workspace aufgeloest wird. Absolute paths werden nur akzeptiert, wenn sie innerhalb des workspace aufgeloest werden.
  </ParamField>

  ## Rückgaben

  <ResponseField name={"content"} type={"string"}>
    File contents werden als Lua string mit expliziter Laenge zurueckgegeben. Bytes wie null bytes, line endings und BOM bytes werden von readfile nicht transformiert.
  </ResponseField>

  ## Beispiel

  Lies bytes aus einem existing workspace file.

  ```lua theme={null}
  local path = "examples/config.json"
  writefile(path, '{"enabled":true}')

  local content = readfile(path)
  print(content)
  print(#content)
  ```
</div>
