Skip to content

gos.file.unzip

Extract a validated ZIP at load time within sandbox and size limits.

Signature

gos.file.unzip(path, target)

Contract and usage

UnzipArchive(path, target)

Alias: gos.file.unzip(path, target).

Extracts a .zip synchronously. Call it while loading; tick callbacks receive false, error. Returns true only after extraction and output verification finish, or false, error on failure.

Archive paths and sizes are checked before extraction. Links, duplicate output paths, disallowed file types and paths escaping approved roots are rejected; total extracted size is limited to 512 MiB. Failure may leave partial output and does not restore an existing destination.

Root Constants

Each path ends with the platform directory separator:

SCRIPT_PATH
COMMON_PATH
SPRITE_PATH
FONTS_PATH
SOUNDS_PATH
CACHE_PATH

SCRIPT_PATH is the current entry script's directory; COMMON_PATH is the configured shared-module root. To find their actual values, run the status panel and open its Log tab. Open Folder opens the active-script directory. Shared modules need not be beside a portable entry script; use COMMON_PATH instead of guessing a path.

Relative file paths resolve from SCRIPT_PATH. File operations must stay inside the approved roots; network-share and device paths are rejected.

File Helpers

Global helpers and their gos.file aliases have identical arguments and results. An omitted error return becomes nil in a two-variable assignment.

Full modules and files contract