32 breaking releases

0.33.0 Sep 4, 2024
0.32.0 Jul 14, 2024
0.31.0 Jun 17, 2024
0.28.0 Mar 28, 2024
0.2.0 Jul 21, 2021

#269 in Compression

Download history 1234/week @ 2024-07-29 2484/week @ 2024-08-05 1927/week @ 2024-08-12 1497/week @ 2024-08-19 1427/week @ 2024-08-26 1583/week @ 2024-09-02 1067/week @ 2024-09-09 971/week @ 2024-09-16 1409/week @ 2024-09-23 1036/week @ 2024-09-30 2194/week @ 2024-10-07 1736/week @ 2024-10-14 1336/week @ 2024-10-21 1416/week @ 2024-10-28 1244/week @ 2024-11-04 1145/week @ 2024-11-11

5,233 downloads per month
Used in 83 crates (16 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–6.5MB
~39K SLoC