Trebejo.Compress.Algorithm (Trebejo v2.0.0)

Copy Markdown View Source

Single-file compression algorithms: zstd, xz, bzip2.

Summary

Functions

Compresses a single file with the specified algorithm. Replaces the original with the compressed version.

Decompresses a single file. Algorithm auto-detected from extension.

Types

single_algo()

@type single_algo() :: :zstd | :xz | :bzip2 | :gzip

Functions

compress(file, algo)

@spec compress(binary(), single_algo()) :: {:ok, binary()} | {:error, binary()}

Compresses a single file with the specified algorithm. Replaces the original with the compressed version.

decompress(file, algo)

@spec decompress(binary(), single_algo()) :: {:ok, binary()} | {:error, binary()}

Decompresses a single file. Algorithm auto-detected from extension.