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

# writefile

> workspace 안의 파일에 Lua string bytes 를 쓰고, missing parent directories 를 만들며, 파일이 이미 있으면 file contents 를 교체합니다.

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

  ## 별칭

  * `writefileasync`

  ## 인수

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

  <ParamField path={"content"} type={"string"} required>
    쓸 Lua string bytes 입니다. 데이터는 binary truncate mode 로 쓰입니다. writefile 은 newlines, BOM bytes, null terminators 또는 다른 extra bytes 를 추가하지 않습니다.
  </ParamField>

  ## 예제

  workspace file 에 bytes 를 쓰고 existing contents 를 교체합니다.

  ```lua theme={null}
  local path = "examples/config.json"

  writefile(path, '{"enabled":true}')
  print(readfile(path))

  writefile(path, "")
  print(#readfile(path))
  ```
</div>
