[−][src]Crate autocompress
Automatically select suitable decoder from magic bytes or encoder from file extension.
Supported file formats
- Gzip
- Zlib (Cannot suggest format from magic bytes and file extension)
- BZip2
- XZ
- Snappy (Cannot suggest format from file extension)
- Z-standard
- LZ4
- Brotli (Cannot suggest format from magic bytes)
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 |
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 |
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 |