ReferenceFilesystem

readfile

Reads a workspace file as bytes. Binary data, including zero bytes, is preserved. Missing files, denied access and invalid paths raise errors.

Syntax

readfile(path: string) -> string

Also available as

read_file

Parameters

ParameterTypeDescription
pathstringPath relative to the workspace.

Returns

TypeDescription
stringComplete file contents.

Description

File operations are confined to the current workspace. Absolute paths and traversal outside it are not accepted. Use a file dialog when the user needs to choose an external file.

Example

writefile("example.txt", "hello")
print(readfile("example.txt"))

These are Game executor contracts. Check build requirements and session lifetimes before using them.