Expand description
This library provides both high level readers and writers for the BGZF format as well as lower level compressor and decompressor functions.
Bgzf is a multi-gzip format that adds an extra field to the header indicating how large the complete block (with header and footer) is.
§Examples
use bgzf::{Reader, Writer};
use std::error::Error;
use std::io;
/// Contrived example that decompresses stdin and compresses to stdout.
fn main() -> Result<(), Box<dyn Error>> {
let mut reader = Reader::new(io::stdin());
let mut writer = Writer::new(io::stdout(), 2.try_into()?);
let total_bytes = io::copy(&mut reader, &mut writer)?;
eprintln!("{} uncompressed bytes", total_bytes);
Ok(())
}Structs§
- Compression
Level - Level of compression to use for for the compressors.
- Compressor
Compressorwill BGZF compress a block of bytes with theCompressor::compressmethod, allowing for reuse of the compressor itself.- Reader
- A BGZF reader.
- Writer
- A BGZF writer.
Enums§
Constants§
- BGZF_
BLOCK_ SIZE - The maximum uncompressed blocksize for BGZF compression (taken from bgzip), used for initializing blocks.
- BUFSIZE
- 128 KB default buffer size, same as pigz.