1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
<h1 align="center">async-tar</h1>
<div align="center">
<strong>
A tar archive reading/writing library for async Rust.
</strong>
</div>
<br />
<div align="center">
<!-- Crates version -->
<a href="https://crates.io/crates/async-tar">
<img src="https://img.shields.io/crates/v/async-tar.svg?style=flat-square"
alt="Crates.io version" />
</a>
<!-- Downloads -->
<a href="https://crates.io/crates/async-tar">
<img src="https://img.shields.io/crates/d/async-tar.svg?style=flat-square"
alt="Download" />
</a>
<!-- docs.rs docs -->
<a href="https://docs.rs/async-tar">
<img src="https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square"
alt="docs.rs docs" />
</a>
</div>
<div align="center">
<h3>
<a href="https://docs.rs/async-tar">
API Docs
</a>
<span> | </span>
<a href="https://github.com/dignifiedquire/async-tar/releases">
Releases
</a>
</h3>
</div>
<br/>
> Based on the great [tar-rs](https://github.com/alexcrichton/tar-rs).
## Reading an archive
```rust,no_run
use async_std::io::stdin;
use async_std::prelude::*;
use async_tar::Archive;
fn main() {
async_std::task::block_on(async {
let mut ar = Archive::new(stdin());
let mut entries = ar.entries().unwrap();
while let Some(file) = entries.next().await {
let f = file.unwrap();
println!("{}", f.path().unwrap().display());
}
});
}
```
## Writing an archive
```rust,no_run
use async_std::fs::File;
use async_tar::Builder;
fn main() {
async_std::task::block_on(async {
let file = File::create("foo.tar").await.unwrap();
let mut a = Builder::new(file);
a.append_path("README.md").await.unwrap();
a.append_file("lib.rs", &mut File::open("src/lib.rs").await.unwrap())
.await
.unwrap();
});
}
```
# MSRV
Minimal stable rust version: 1.51
*An increase to the MSRV is accompanied by a minor version bump*
# License
This project is licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
http://opensource.org/licenses/MIT)
at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in this project by you, as defined in the Apache-2.0 license,
shall be dual licensed as above, without any additional terms or conditions.
|