Skip to main content

Module zip

Module zip 

Source
Expand description

A zip reader over miniz_oxide, for game-root overlays: what is in a package, and putting it on disk where it says. No entry is ever interpreted, and there is no writer, since backups are plain file copies.

Paths are /-separated on every host, because they are also the ledgerโ€™s keys. An archive and each entry are held in memory whole; real packages stay under 50 MB.

Modulesยง

archive ๐Ÿ”’
central_directory ๐Ÿ”’
crc32 ๐Ÿ”’
entry_data ๐Ÿ”’
entry_name ๐Ÿ”’
extraction ๐Ÿ”’
zip_error ๐Ÿ”’

Structsยง

Archive
A package whose central directory has been read once. Finding each file by walking the directory again cost an install of n files nยฒ entry parses: 8.5 s of a 12 s install at 3 000 files.
FileEntry
One file a package will install.
ZipError
Readable as-is by the user.

Functionsยง

entries
The files a package will own, in zip order; directory entries are left out, since an empty directory is nothing to back up, record or delete.
entry_paths
extract
Extracts into dest_dir, overwriting existing files as the legacy installer did, and returns the files written in the form entry_paths reports them.
read_entry
One fileโ€™s bytes, matched case-insensitively. Reading several from one package goes through Archive, which reads the directory only once.
safe_relative
An entry name as a relative /-separated path that cannot leave the target, or None for a name that tries: any .. segment, a leading separator, a : (a drive or an alternate data stream), a NUL, or nothing at all. Names Windows would quietly rewrite go too: a trailing dot or space, and a reserved device name such as aux.ini.