| 1 |
# bzip2-rs |
| 2 |
|
| 3 |
[](https://crates.io/crates/bzip2-rs) |
| 4 |
[](https://docs.rs/bzip2-rs) |
| 5 |
[](https://deps.rs/crate/bzip2-rs/0.1.2) |
| 6 |
[](https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html) |
| 7 |
[](https://github.com/paolobarbolini/bzip2-rs/actions?query=workflow%3ACI) |
| 8 |
|
| 9 |
Pure Rust 100% safe bzip2 decompressor. |
| 10 |
|
| 11 |
## Features |
| 12 |
|
| 13 |
* Default features: Rust >= 1.34.2 is supported |
| 14 |
* `rustc_1_37`: bump MSRV to 1.37, enable more optimizations |
| 15 |
* `nightly`: require Rust Nightly, enable more optimizations |
| 16 |
|
| 17 |
## Usage |
| 18 |
|
| 19 |
```rust |
| 20 |
use std::fs::File; |
| 21 |
use std::io; |
| 22 |
use bzip2_rs::DecoderReader; |
| 23 |
|
| 24 |
let mut compressed_file = File::open("input.bz2")?; |
| 25 |
let mut decompressed_output = File::create("output")?; |
| 26 |
|
| 27 |
let mut reader = DecoderReader::new(compressed_file); |
| 28 |
io::copy(&mut reader, &mut decompressed_output)?; |
| 29 |
``` |
| 30 |
|
| 31 |
## Upcoming features |
| 32 |
|
| 33 |
* parallel decoding support (similar to [pbzip2](https://github.com/cosnicolaou/pbzip2)) |
| 34 |
* bzip2 encoding support |
| 35 |
* no_std support (is anybody interested with this?) |
| 36 |
|
| 37 |
## License |
| 38 |
|
| 39 |
Licensed under either of |
| 40 |
* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) |
| 41 |
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) |
| 42 |
|
| 43 |
at your option. |
| 44 |
|
| 45 |
### Contribution |
| 46 |
|
| 47 |
Unless you explicitly state otherwise, any contribution intentionally submitted |
| 48 |
for inclusion in the work by you shall be dual licensed as above, without any |
| 49 |
additional terms or conditions. |