Skip to main content

compress_bytes

Function compress_bytes 

Source
pub fn compress_bytes(
    data: &[u8],
    compression: CompressionType,
    level: u8,
) -> Result<Vec<u8>>
Expand description

Compress raw bytes with the given algorithm via OxiARC’s Pure Rust compression crates (COOLJAPAN compression policy: oxiarc-* only, never flate2/zstd/zip/lz4/brotli/snap/tar from crates.io).

level is a generic 0-9 dial; it is remapped per algorithm (Zstd 1-22, Brotli quality 0-11, Gzip 0-9, LZ4 uses its default fast mode).

CompressionType::VectorQuantization is not a general-purpose byte compressor (it would require training a codebook over the vectors, not raw bytes) and is intentionally left unimplemented here: it fails loudly instead of silently returning uncompressed data.