docs.rs failed to build tar-0.2.3
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
tar-0.4.38
tar-rs
A tar archive reading/writing library for Rust.
# Cargo.toml
[dependencies.tar]
git = "https://github.com/alexcrichton/tar-rs"
Reading an archive
# #![allow(unused_must_use, unstable)]
extern crate tar;
use std::io::prelude::*;
use std::io::SeekFrom;
use std::fs::File;
use tar::Archive;
fn main() {
let file = File::open("foo.tar").unwrap();
let a = Archive::new(file);
for file in a.files().unwrap() {
// Make sure there wasn't an I/O error
let mut file = file.unwrap();
// Inspect metadata about the file
println!("{:?}", file.filename());
println!("{}", file.size());
// files implement the Read trait
let mut s = String::new();
file.read_to_string(&mut s).unwrap();
println!("{}", s);
// files also implement the Seek trait
file.seek(SeekFrom::Current(0)).unwrap();
}
}
Writing an archive
# #![allow(unused_must_use, unstable)]
extern crate tar;
use std::io::prelude::*;
use std::fs::File;
use tar::Archive;
fn main() {
let file = File::create("foo.tar").unwrap();
let a = Archive::new(file);
a.append("file1.txt", &mut File::open("file1.txt").unwrap());
a.append("file2.txt", &mut File::open("file2.txt").unwrap());
a.finish();
}
License
tar-rs
is primarily distributed under the terms of both the MIT license and
the Apache License (Version 2.0), with portions covered by various BSD-like
licenses.
See LICENSE-APACHE, and LICENSE-MIT for details.