29 breaking releases

new 0.30.0 May 16, 2024
0.28.0 Mar 28, 2024
0.26.0 Dec 14, 2023
0.25.0 Oct 12, 2023
0.2.0 Jul 21, 2021

#239 in Compression

Download history 1096/week @ 2024-01-26 1064/week @ 2024-02-02 782/week @ 2024-02-09 1037/week @ 2024-02-16 1100/week @ 2024-02-23 1073/week @ 2024-03-01 1558/week @ 2024-03-08 1166/week @ 2024-03-15 904/week @ 2024-03-22 1276/week @ 2024-03-29 960/week @ 2024-04-05 1122/week @ 2024-04-12 1140/week @ 2024-04-19 1150/week @ 2024-04-26 1032/week @ 2024-05-03 765/week @ 2024-05-10

4,208 downloads per month
Used in 73 crates (19 directly)

MIT license

120KB
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–2.3MB
~39K SLoC