Universal compression and archive utilities.
Wraps system-level tools behind a consistent {:ok, result} | {:error, reason}
interface. Supports: zip, tar (gzip/bzip2/xz/zstd), gzip, gunzip, zstd, xz,
bzip2, 7z, rar. Auto-detects format from file extension.
This module is a facade that delegates to per-format sub-modules:
Trebejo.Compress.Format, .Zip, .Tar, .Gzip, .Algorithm, .SevenZ, .Rar.
Summary
Functions
Compresses a single file with the specified algorithm.
Replaces the original with the compressed version.
Delegates to Trebejo.Compress.Algorithm.compress/2.
Creates a 7z archive from source paths.
Creates a RAR archive from source paths.
Decompresses a single file. Algorithm auto-detected from extension.
Delegates to Trebejo.Compress.Algorithm.decompress/2.
Detects the archive or compression type from a file extension.
Delegates to Trebejo.Compress.Format.detect_type/1.
Extracts an archive, auto-detecting the format from its extension.
Extracts a 7z archive.
Extracts a RAR archive.
Decompresses a gzip file, keeping the original.
Compresses a file with gzip (replaces original with .gz).
Lists the contents of an archive. Auto-detects format.
Creates a tar archive. Supports compression: :gzip, :bzip2, :xz, :zstd, :none.
Delegates to Trebejo.Compress.Tar.tar/3.
Extracts a tar archive. Compression auto-detected from extension.
Extracts a zip archive.
Delegates to Trebejo.Compress.Zip.unzip/2.
Creates a zip archive from source paths. Supports password.
Delegates to Trebejo.Compress.Zip.zip/3.
Types
@type archive_type() :: Trebejo.Compress.Format.archive_type()
@type single_algo() :: Trebejo.Compress.Algorithm.single_algo()
Functions
@spec compress(binary(), single_algo()) :: {:ok, binary()} | {:error, binary()}
Compresses a single file with the specified algorithm.
Replaces the original with the compressed version.
Delegates to Trebejo.Compress.Algorithm.compress/2.
Creates a 7z archive from source paths.
Creates a RAR archive from source paths.
@spec decompress(binary(), single_algo()) :: {:ok, binary()} | {:error, binary()}
Decompresses a single file. Algorithm auto-detected from extension.
Delegates to Trebejo.Compress.Algorithm.decompress/2.
@spec detect_type(binary()) :: archive_type()
Detects the archive or compression type from a file extension.
Delegates to Trebejo.Compress.Format.detect_type/1.
Extracts an archive, auto-detecting the format from its extension.
Options
:output— destination directory (default: current directory):password— optional password for zip/7z/rar
Extracts a 7z archive.
Extracts a RAR archive.
Decompresses a gzip file, keeping the original.
Compresses a file with gzip (replaces original with .gz).
Lists the contents of an archive. Auto-detects format.
Creates a tar archive. Supports compression: :gzip, :bzip2, :xz, :zstd, :none.
Delegates to Trebejo.Compress.Tar.tar/3.
Extracts a tar archive. Compression auto-detected from extension.
Extracts a zip archive.
Delegates to Trebejo.Compress.Zip.unzip/2.
Creates a zip archive from source paths. Supports password.
Delegates to Trebejo.Compress.Zip.zip/3.