ReadFile

Read the full contents of a sandboxed .ssn file as a string.

Syntax

Susano.ReadFile(name) -> string | nil

Parameters

name (string): The filename. Must be a plain name.ssn: no directories, no path separators, no traversal.

Return(s)

string: The full file contents on success. Binary-safe: embedded null bytes are preserved.

nil: Returned if the file does not exist or could not be opened.

Behavior

Validates name first: only single filenames matching the name.ssn pattern are accepted. Any attempt to pass a path, use .., or reference another extension raises a Lua error.

Reads the whole file in binary mode. Suitable for JSON blobs, serialized tables, or any small persistent data. Not intended for very large files: the entire content is loaded into memory as a Lua string.

Example(s)

local raw = Susano.ReadFile("settings.ssn")
if raw then
    local settings = json.decode(raw)
    print("Aimbot:", settings.aimbot)
else
    print("No settings file yet: using defaults")
end