35 breaking releases

new 0.36.0 Feb 6, 2025
0.34.0 Dec 12, 2024
0.33.0 Sep 4, 2024
0.32.0 Jul 14, 2024
0.2.0 Jul 21, 2021

#270 in Compression

Download history 1500/week @ 2024-10-22 1430/week @ 2024-10-29 1360/week @ 2024-11-05 948/week @ 2024-11-12 1484/week @ 2024-11-19 1540/week @ 2024-11-26 1553/week @ 2024-12-03 1857/week @ 2024-12-10 1621/week @ 2024-12-17 634/week @ 2024-12-24 1058/week @ 2024-12-31 1828/week @ 2025-01-07 2287/week @ 2025-01-14 2240/week @ 2025-01-21 3160/week @ 2025-01-28 3066/week @ 2025-02-04

11,104 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

~0.8–7MB
~39K SLoC