13 releases (breaking)

0.11.0 Sep 4, 2023
0.10.0 Dec 27, 2022
0.9.0 Dec 11, 2022
0.7.0+slow5lib.0.8.0 Nov 2, 2022
0.3.1 Mar 26, 2022

#52 in Biology

Download history 8/week @ 2024-02-22 7/week @ 2024-02-29 17/week @ 2024-03-07 61/week @ 2024-03-14

92 downloads per month


17K SLoC

C 11K SLoC // 0.1% comments Cython 2K SLoC // 0.1% comments Rust 2K SLoC // 0.0% comments Python 1.5K SLoC // 0.2% comments Shell 577 SLoC // 0.2% comments


License Crates.io docs.rs Rust Stability codecov

A library for interacting with SLOW5/BLOW5 files in rust. Not official.

For more information checkout the main slow5lib repository.

Note: Library design is in flux and care should be taken in upgrading this crate.


Add the following to your Cargo.toml:

slow5 = "0.11"


If you'd like to download the git version, use the following command to download the repo

git clone --recursive https://github.com/bsaintjo/slow5-rs.git

Getting started

Reading signal from SLOW5 file

use slow5::{FileReader, RecordExt};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut slow5 = FileReader::open("examples/example.slow5").unwrap();
    for record in slow5.records() {
        for signal in record?.picoamps_signal_iter() {
            // Do stuff

Writing a compressed BLOW5 file with attributes

use std::error::Error;
use slow5::{FileWriter, SignalCompression, Record};

fn main() -> Result<(), Box<dyn Error>> {
    let tmp_dir = std::env::temp_dir();
    let output = tmp_dir.join("test.blow5");
    let mut writer = FileWriter::options()
        .attr("attribute", "value", 0)
    let rec = Record::builder()
        .raw_signal(&[0, 1, 2, 3])

More example code

For more example code, see the test code. Several examples from the original library have been ported to rust and can be found in the examples directory.

Feature flags

  • zstd: Enable zstd-based compression (enabled by default)
  • zlib-ng: Enable usage of high performance zlib-ng, adds cmake dependency
  • serde: Enable serde dependency (mainly for serializing Record)


Licensed under either of

at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


~121K SLoC