Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

precomp2

precomp2 is a Rust library for reversible preprocessing of compressed and container data. It turns recognizable streams into PCF2 segments that are easier for an outer compressor to handle, then restores the original bytes exactly.

The project is inspired by precomp-cpp and preflate-rs.

Features

  • Lossless encode/decode APIs for byte slices and async decode input.
  • PCF2 segment container with literal, nested, DEFLATE, zlib, gzip, PNG IDAT, JPEG, Base64, bzip2, and PDF Flate segment kinds.
  • Recursive preprocessing with depth and output budget limits.
  • Optional PNG WebP, PDF predictor, and PDF bitmap fallback transforms behind EncodeConfig flags.

Usage

use precomp2::{DecodeConfig, EncodeConfig};

fn main() -> precomp2::Result<()> {
    let input = b"payload";
    let encoded = precomp2::encode_bytes(input, &EncodeConfig::default())?;
    let decoded = precomp2::decode_bytes(&encoded, &DecodeConfig::default())?;

    assert_eq!(decoded, input);
    Ok(())
}

Status

This crate is early-stage. The on-disk PCF2 format should be treated as unstable until a 1.0 release.

License

Licensed under the Apache License, Version 2.0.

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages