Skip to main content

encode_file

Function encode_file 

Source
pub fn encode_file<P: AsRef<Path>, Q: AsRef<Path>>(
    input_path: P,
    output_path: Q,
    max_order: Option<usize>,
) -> PpmResult<()>
Expand description

Compress the file at input_path into output_path using PPM.

  • max_order = None ⇒ uses the crate’s DEFAULT_ORDER (5).
  • max_order = Some(n) ⇒ uses order n (up to 16).

By default, we first write an 8-byte little-endian prefix giving the original file length, then the PPM‐encoded payload.

§Errors

Returns an error if any I/O or encoding step fails.