appendfileasync Asynchronous

Add bytes to the end of a workspace file on a background thread. It suits logs that grow while the game runs.

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

Parameters

Function parameters
ParameterTypeDescription
pathstringWorkspace-relative path of the file to extend.
contentsstringBytes to append.

Returns

()

No values.

Usage notes

The file work runs on a background thread, and the call always yields at least one frame, even for a small file. Filesystem failures raise in the calling thread.

Example

Example
Luau
writefile("async-log.txt", "Started\n")
appendfileasync("async-log.txt", "Background entry\n")
print(readfile("async-log.txt"))
delfile("async-log.txt")