appendfile Synchronous

  • appendfileasync

Add a string after the existing contents of a workspace file. Use it for log entries or other data that accumulates over time. The existing file stays intact before the new bytes. Include a newline in each entry if you want a line-oriented log.

Syntax
Luau
appendfile(path: string, contents: string) -> ()

Parameters

Function parameters
ParameterTypeDescription
pathstringPath inside the Kawaii workspace, for example settings/theme.json.
contentsstringString containing the bytes to write. Text and binary strings are accepted.

Returns

()

This function returns no values.

Usage notes

The file and any missing parent folders are created if needed. Newline characters are not added automatically.

Differences from Volt

Volt documents access through explicitly created workspace symlinks. Kawaii rejects symlinks in workspace paths; all workspace operations remain subject to its path containment checks.

Example

Example
Luau
writefile("session.log", "Started\n")
appendfile("session.log", "Saved preferences\n")
print(readfile("session.log"))
Kawaii documentation