36 breaking releases

new 0.37.0 Mar 8, 2025
0.35.0 Jan 19, 2025
0.34.0 Dec 12, 2024
0.33.0 Sep 4, 2024
0.2.0 Jul 21, 2021

#346 in Compression

Download history 1349/week @ 2024-11-17 1555/week @ 2024-11-24 1545/week @ 2024-12-01 1729/week @ 2024-12-08 1781/week @ 2024-12-15 826/week @ 2024-12-22 686/week @ 2024-12-29 1845/week @ 2025-01-05 2259/week @ 2025-01-12 2270/week @ 2025-01-19 2704/week @ 2025-01-26 3680/week @ 2025-02-02 4153/week @ 2025-02-09 2138/week @ 2025-02-16 2486/week @ 2025-02-23 2059/week @ 2025-03-02

11,219 downloads per month
Used in 91 crates (17 directly)

MIT license

135KB
3K SLoC

noodles-bgzf handles the reading and writing of the blocked gzip format (BGZF).

While the gzip format is typically a single stream, a BGZF is the concatenation of many gzip streams. Each stream is called a block, with its uncompressed data size being constrained to less than 64 KiB. This multistream gzip allows random access using virtual positions.

noodles-bgzf abstracts away the concept of blocks, implementing std::io::Read for the reader and std::io::Write for the writer.

Examples

Read an entire BGZF file

use noodles_bgzf as bgzf;
let mut reader = File::open("data.gz").map(bgzf::Reader::new)?;
let mut data = Vec::new();
reader.read_to_end(&mut data)?;

Write a BGZF file

use noodles_bgzf as bgzf;
let mut writer = File::create("data.gz").map(bgzf::Writer::new)?;
writer.write_all(b"noodles-bgzf")?;

Dependencies

~1.4–7.5MB
~51K SLoC