Skip to main content

Module package

Module package 

Source
Expand description

Package- and diff-archive tarball helpers.

Both package archives (.socket/packages/<uuid>.tar.gz) and diff archives (.socket/diffs/<uuid>.tar.gz) use the same on-disk format: a gzipped tar containing one entry per patched file. The entry’s path matches the normalized relative file path (i.e. without the package/ prefix used by the API).

For package archives, each entry holds the patched file’s full bytes. For diff archives, each entry holds a bsdiff delta that transforms the corresponding beforeHash content into the afterHash content.

Enums§

ArchiveError
Errors produced while reading a package/diff archive.

Functions§

read_archive_filtered
Subset of read_archive_to_map that only keeps entries whose normalized path appears in expected_files. Anything else in the archive is silently dropped — this is defense-in-depth so a malicious archive cannot drop arbitrary files into the package directory.
read_archive_to_map
Read a .tar.gz archive into a map of normalized_path -> bytes.