[][src]Crate autocompress

Automatically select suitable decoder from magic bytes or encoder from file extension.

Supported file formats

Example

use autocompress::open;
use std::io::{self, Read};

fn main() -> io::Result<()> {
  let mut buffer = Vec::new();
  open("testfiles/plain.txt.xz")?.read_to_end(&mut buffer)?;
  assert_eq!(buffer, b"ABCDEFG\r\n1234567");
  Ok(())
}

Structs

Decoder

structure of decoding reader

Encoder

structure of encoding writer

Enums

CompressionLevel

List of compression levels

Format

List of supported file formats

Functions

create

Create new writer from file path. File format is suggested from file extension.

create_or_stdout

Create new writer from a file path. If a file path is None, standard output is used. File format is suggested from file extension.

open

Open new reader from file path. File format is suggested from magic bytes and file extension.

open_or_stdin

Open new reader from file path. If path is None, standard input is used. File format is suggested from magic bytes and file extension.

suggest_format

Suggest file format from magic bytes. This function does not consume data.

suggest_format_from_path

Suggest file format from a path extension