44 breaking releases

Uses new Rust 2024

0.45.0 Dec 11, 2025
0.44.0 Nov 13, 2025
0.43.0 Aug 25, 2025
0.42.0 Jul 12, 2025
0.2.0 Jul 21, 2021

#307 in Compression

Download history 4602/week @ 2025-09-25 4724/week @ 2025-10-02 4637/week @ 2025-10-09 5056/week @ 2025-10-16 6704/week @ 2025-10-23 5600/week @ 2025-10-30 4830/week @ 2025-11-06 6586/week @ 2025-11-13 6424/week @ 2025-11-20 3892/week @ 2025-11-27 3884/week @ 2025-12-04 4830/week @ 2025-12-11 3141/week @ 2025-12-18 1534/week @ 2025-12-25 3177/week @ 2026-01-01 4104/week @ 2026-01-08

12,896 downloads per month
Used in 121 crates (18 directly)

MIT license

140KB
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::io::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::io::Writer::new)?;
writer.write_all(b"noodles-bgzf")?;

Dependencies

~1.3–2.4MB
~40K SLoC