zopen 1.0.0

Automatically open compressed files.
Documentation
# zopen

[![rs-graph crate](https://img.shields.io/crates/v/zopen.svg)](https://crates.io/crates/zopen)
[![zopen docs](https://docs.rs/zopen/badge.svg)](https://docs.rs/zopen)

## Introduction

Simple crate that automatically open compressed files.

The compressor used is determined by the file extension. If the
corresponding compression library is not available (i.e. the corresponding
feature is not activated), the crate tries to use an external compression
tool (gzip, bzip2, xz or zstd).

The crate exports two functions [`read`] and [`write`]. Given a file path,
they return a `Box<Read>` or a `Box<Write>`, respectively, accessing the file.
Depending on the file extension, the file is filtered through an appropriate
compressor/decompressor.

## Examples

Reading a compressed file:
```rust
let mut f = zopen::read("test.file.gz")?; // open gzip compressed file.
let mut data = String::new();
f.read_to_string(&mut data)?;
```

Writing to a compressed file:
```rust
let mut f = zopen::write("test.file.zst")?; // create zstd compressed file.
writeln!(f, "{}: {}", "Hello world", 42)?;
```

## Author

Frank Fischer <frank-fischer@shadow-soft.de>

## Installation

Put the requirement `zopen = "^1.0.0"` into the `Cargo.toml` of
your project. Optionally, you may enable one (or `all`) of the features 
(`gzip`, `bzip2`, `xz`, `zstd`) to use external crates (instead of command line tools) 
for compression.

## Documentation

See [docs.rs](https://docs.rs/zopen).

## Example

Reading a compressed file:

```rust
let mut f = zopen::read("test.file.gz")?; // open gzip compressed file.
let mut data = String::new();
f.read_to_string(&mut data)?;
```

Writing a compressed file:

```rust
let mut f = zopen::write("test.file.zst")?; // create zstd compressed file.
writeln!(f, "{}: {}", "Hello world", 42)?;
```

## Download

Source code of latest tagged version: [zopen-v1.0.0.tar.gz](/tarball/zopen-v1.0.0.tar.gz?uuid=v1.0.0)

Source code of trunk: [zopen-trunk.tar.gz](/tarball/zopen-trunk.tar.gz?name=zopen&uuid=trunk)