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

> Читает existing regular file внутри workspace в binary mode и возвращает его bytes как Lua string.

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

  ## Алиасы

  * `readfileasync`

  ## Аргументы

  <ParamField path={"path"} type={"string"} required>
    File path разрешается внутри workspace после separator normalization, workspace-boundary checks и filename/extension checks. Absolute paths принимаются только если разрешаются внутри workspace.
  </ParamField>

  ## Возвраты

  <ResponseField name={"content"} type={"string"}>
    File contents возвращаются как Lua string с явной длиной. Bytes вроде null bytes, line endings и BOM bytes не преобразуются readfile.
  </ResponseField>

  ## Пример

  Прочитайте bytes из existing workspace file.

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

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