Reference · reference

archive module

1 min read · 2026-09-02 · config-weave 0.1.0

use archive extracts archives without an external tar or unzip binary. Every function takes the archive path and a destination directory, and returns Result[int, string] where the integer is the number of entries extracted. Fetch archives with the http module and verify them with the hash module before extracting.

extract_zip

rust
archive::extract_zip(archive: string, dest: string) -> Result[int, string]

Extracts a .zip file into dest.

extract_tar_gz

rust
archive::extract_tar_gz(archive: string, dest: string) -> Result[int, string]

Extracts a gzip-compressed tar file into dest.

extract

rust
archive::extract(archive: string, dest: string) -> Result[int, string]

Chooses the format from the file extension and extracts. It accepts .zip, .tar.gz and .tgz, and fails on any other extension.

rust
use archive

let entries = archive::extract("/tmp/tool.tar.gz", "/opt/tool")?