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

> Zapisuje Lua string bytes do pliku wewnatrz workspace, tworzy missing parent directories i zastepuje file contents, jesli plik juz istnieje.

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

  ## Aliasy

  * `writefileasync`

  ## Argumenty

  <ParamField path={"path"} type={"string"} required>
    File path rozwiazywany wewnatrz workspace po separator normalization, workspace-boundary checks oraz filename/extension checks. Absolute paths sa akceptowane tylko jesli rozwiazuja sie wewnatrz workspace.
  </ParamField>

  <ParamField path={"content"} type={"string"} required>
    Lua string bytes do zapisania. Dane sa zapisywane w binary truncate mode; writefile nie dodaje newlines, BOM bytes, null terminators ani innych extra bytes.
  </ParamField>

  ## Przykład

  Zapisz bytes do workspace file i zastap kazde existing contents.

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

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

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