Crate retrocompressor

source ·
Expand description

Retrocompressor Library

Compress or expand retro file formats

  • direct_ports::lzhuf is a nearly direct port of LZHUF by Okumura et al.
  • lzss_huff produces output compatible with LZHUF using a different implementation
  • td0 converts between advanced (compressed) and normal (expanded) TD0 disk image formats

The compression/expansion functions are generics that operate on trait objects with bounds Read + Seek or Write + Seek. There are convenience functions for working directly with buffers.

File Example

use retrocompressor::*;
let mut in_file = std::fs::File::open("some_input_path").expect("open failed");
let mut out_file = std::fs::File::create("some_output_path").expect("create failed");
let (in_size,out_size) = lzss_huff::expand(&mut in_file,&mut out_file,&STD_OPTIONS)
    .expect("expansion failed");
eprintln!("expanded {} into {}",in_size,out_size);

Buffer Example

use retrocompressor::*;
let test_data = "This is the chaunt of the priests.  The chaunt of the priests of Mung.".as_bytes();
let compressed = lzss_huff::compress_slice(test_data,&STD_OPTIONS).expect("compression failed");

Modules

Structs

  • Options controlling compression

Enums

Constants