> ## 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

> Lee un existing regular file dentro del workspace en binary mode y devuelve sus bytes como Lua string.

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

  ## Alias

  * `readfileasync`

  ## Argumentos

  <ParamField path={"path"} type={"string"} required>
    File path resuelto dentro del workspace despues de separator normalization, workspace-boundary checks y filename/extension checks. Absolute paths solo se aceptan si resuelven dentro del workspace.
  </ParamField>

  ## Retornos

  <ResponseField name={"content"} type={"string"}>
    File contents se devuelven como Lua string con longitud explicita. Bytes como null bytes, line endings y BOM bytes no son transformados por readfile.
  </ResponseField>

  ## Ejemplo

  Lee bytes desde un existing workspace file.

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

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