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

> Le um existing regular file dentro do workspace em binary mode e retorna seus bytes como Lua string.

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

  ## Aliases

  * `readfileasync`

  ## Argumentos

  <ParamField path={"path"} type={"string"} required>
    File path resolvido dentro do workspace apos separator normalization, workspace-boundary checks e filename/extension checks. Absolute paths so sao aceitos se resolverem dentro do workspace.
  </ParamField>

  ## Retornos

  <ResponseField name={"content"} type={"string"}>
    File contents sao retornados como Lua string com comprimento explicito. Bytes como null bytes, line endings e BOM bytes nao sao transformados por readfile.
  </ResponseField>

  ## Exemplo

  Leia bytes de um existing workspace file.

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

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