WriteFileAsync

Last Updated2026-07-30
Created At2026-07-30

Writes size raw bytes from contents without blocking the game thread.

native void WriteFileAsync(const char[] path, const char[] contents, int size, FileOpCallback callback, any data = 0, bool append = false, bool use_valve_fs = false, const char[] valve_path_id = "DEFAULT_WRITE_PATH")

Parameters

const char[] path
Path to the file.
const char[] contents
Raw-byte buffer to write.
int size
Number of bytes to write from contents.
Callback invoked on completion.
any data
User data passed to the callback.
bool append
If true, append rather than overwrite.
bool use_valve_fs
If true, use the Valve filesystem.
const char[] valve_path_id
Valve filesystem path; must be DEFAULT_WRITE_PATH.

Return Value

void

Error

The size is negative, the callback is invalid, the async worker is shutting down, Valve async operations are unavailable, or valve_path_id is unsupported.