33 breaking releases

0.34.0 Dec 12, 2024
0.33.0 Sep 4, 2024
0.32.0 Jul 14, 2024
0.28.0 Mar 28, 2024
0.2.0 Jul 21, 2021

#162 in Compression

Download history 1088/week @ 2024-09-27 1444/week @ 2024-10-04 2411/week @ 2024-10-11 1295/week @ 2024-10-18 1407/week @ 2024-10-25 1435/week @ 2024-11-01 1189/week @ 2024-11-08 1177/week @ 2024-11-15 1479/week @ 2024-11-22 1650/week @ 2024-11-29 1751/week @ 2024-12-06 1706/week @ 2024-12-13 1082/week @ 2024-12-20 554/week @ 2024-12-27 1616/week @ 2025-01-03 1959/week @ 2025-01-10

5,379 downloads per month
Used in 90 crates (17 directly)

MIT license

125KB
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