10 stable releases

2.5.0 Jan 12, 2023
2.4.0 Dec 25, 2021
2.3.2 May 28, 2021
2.3.1 Dec 8, 2020
1.0.0 Dec 7, 2019

#39 in Compression

Download history 1761/week @ 2023-12-13 668/week @ 2023-12-20 932/week @ 2023-12-27 857/week @ 2024-01-03 1745/week @ 2024-01-10 2834/week @ 2024-01-17 2371/week @ 2024-01-24 3339/week @ 2024-01-31 3326/week @ 2024-02-07 3899/week @ 2024-02-14 2321/week @ 2024-02-21 3498/week @ 2024-02-28 1853/week @ 2024-03-06 1816/week @ 2024-03-13 1622/week @ 2024-03-20 1593/week @ 2024-03-27

8,353 downloads per month
Used in 21 crates (20 directly)

MIT/Apache

72KB
1.5K SLoC

niffler

Simple and transparent support for compressed files.

This library provides two main features:

  • sniffs out compression formats from input files and returns a Read trait object ready for consumption.
  • Create a Writer initialized with compression ready for writing.

The goal is to lower the barrier to open and use a file, especially in bioinformatics workflows.

build-status Crates.io Documentation

Selecting compression formats

By default all supported compression formats are enabled. If you're working on systems that don't support them you can disable default features and select the ones you want. For example, currently only gz is supported in Webassembly environments (because niffler depends on crates that have system dependencies for bz2 and lzma compression), so you can use this in your Cargo.toml to select only the gz support:

niffler = { version = "2.2.0", default-features = false, features = ["gz"] }

You can still use niffler::sniff() to find what is the compression format, even if any feature is disabled. But if you try to use niffler::get_reader for a disabled feature, it will throw a runtime error.

Minimum supported Rust version

Currently the minimum supported Rust version is 1.57.0.

Similar project

Many similar projects exist in other languages:

Development

niffler development is open, and pull requests are welcome!

Before creating your pull request, please try to write a test and benchmark (if possible). Some commands we suggest running to help with these tasks:

cargo fmt
cargo test
cargo clippy

To run tests use:

cargo test --all-features

To test benchmark run:

cargo test --benches --all-features

To run all benchmark use:

cargo bench --all-features

As a shortcut, you can also run make, which will execute all these commands.

License

Licensed under either of these:

Contributing

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

Dependencies

~3–5MB
~87K SLoC