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

> Doc existing regular file ben trong workspace o binary mode va tra ve bytes cua no duoi dang Lua string.

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

  ## Alias

  * `readfileasync`

  ## Đối số

  <ParamField path={"path"} type={"string"} required>
    File path duoc resolve ben trong workspace sau separator normalization, workspace-boundary checks va filename/extension checks. Absolute paths chi duoc chap nhan neu resolve ben trong workspace.
  </ParamField>

  ## Giá trị trả về

  <ResponseField name={"content"} type={"string"}>
    File contents duoc tra ve duoi dang Lua string voi do dai ro rang. Bytes nhu null bytes, line endings va BOM bytes khong bi transform boi readfile.
  </ResponseField>

  ## Ví dụ

  Doc bytes tu existing workspace file.

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

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