Skip to main content

Crate starbase_archive

Crate starbase_archive 

Source

Modules§

codecs
Compression codecs (gz, bz2, xz, zstd, Z) that wrap read/write streams. Compression codecs that wrap read/write streams.
dmg
Handles macOS dmg disk images (unpack only).
file
Handles single files passed through a codec, like .gz or .zst.
pkg
Handles macOS pkg installer packages (unpack only).
tar
Handles tarball files.
zip
Handles zip files.

Structs§

Archiver
An Archiver is an abstraction for packing and unpacking archives. When packing, the added source files and globs are included in the archive, relative from the source root.

Enums§

ArchiveError

Traits§

ArchivePacker
Abstraction for packing archives.
ArchiveUnpacker
Abstraction for unpacking archives.

Functions§

convert_command_error
copy_extracted_contents
Copy contents that were extracted (or mounted) into the source directory over to the target directory. If a prefix is provided, copy the contents of that sub-directory instead. Used by formats (like dmg) that can’t unpack entries from a stream.
escapes_via_symlink
Returns true if writing to target would escape root by traversing a symlink – for example a symlink entry planted earlier in the same archive that points outside the output directory (CWE-22 / CWE-59). Every already existing ancestor of target beneath root is checked, since create_dir_all and file writes would otherwise follow such a link.
get_compression_extensions
Return a list of all supported compression/codec file extensions, without the format-specific extensions like tar or zip, regardless of which Cargo features are enabled.
get_full_file_extension
Extract the full extension from a file path without leading dot, like tar.gz, instead of just gz. If no file extension is found, returns None.`
get_supported_archive_extensions
Return a list of all supported archive file extensions, regardless of which Cargo features are enabled. Extensions are returned without a leading dot.
is_supported_archive_extension
Return true if the file path has a supported archive extension. This does not check against feature flags!
join_file_name
Join a file name from a list of parts, removing any empty parts.
next_temp_dir
Return a unique temporary directory to mount or expand an archive into. Each unpack requires its own directory, otherwise unpacks running in parallel would collide with each other (mounts would detach each other, and pkgutil refuses to expand into an existing directory), so namespace by process and an incrementing counter.
strip_compression_suffix
Remove a trailing compression extension (.bz2, .gz, .xz, .zst, etc.) from the file name, returning the inner file name.
strip_path_prefix
Strip the prefix from a path, supporting * wildcards in the prefix. A * matches any number of characters within a single component, so * matches a whole component, while partial patterns like name-* match components starting with name-. Wildcards never match across component separators.