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

> workspace 안의 existing regular file 을 binary mode 로 읽고 해당 bytes 를 Lua string 으로 반환합니다.

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

  ## 별칭

  * `readfileasync`

  ## 인수

  <ParamField path={"path"} type={"string"} required>
    separator normalization, workspace-boundary checks, filename/extension checks 후 workspace 안으로 resolve 되는 File path 입니다. Absolute paths 는 workspace 안으로 resolve 될 때만 허용됩니다.
  </ParamField>

  ## 반환값

  <ResponseField name={"content"} type={"string"}>
    File contents 는 명시적 길이를 가진 Lua string 으로 반환됩니다. null bytes, line endings, BOM bytes 같은 bytes 는 readfile 에 의해 변환되지 않습니다.
  </ResponseField>

  ## 예제

  existing workspace file 에서 bytes 를 읽습니다.

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

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