tar

Tar file reading/writing for Rust

Latest version: 0.4.45 registry icon
Maintenance score
57
Safety score
91
Popularity score
87
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
0.4.45 0 0 0 0 0
0.4.44 0 0 2 0 0
0.4.43 0 0 2 0 0
0.4.42 0 0 2 0 0
0.4.41 0 0 2 0 0
0.4.40 0 0 2 0 0
0.4.39 0 0 2 0 0
0.4.38 0 0 2 0 0
0.4.37 0 0 2 0 0
0.4.36 0 0 2 0 0
0.4.35 0 0 3 0 0
0.4.34 0 0 3 0 0
0.4.33 0 0 3 0 0
0.4.32 0 0 3 0 0
0.4.31 0 0 3 0 0
0.4.30 0 0 3 0 0
0.4.29 0 0 3 0 0
0.4.28 0 0 3 0 0
0.4.27 0 0 3 0 0
0.4.26 0 0 3 0 0
0.4.25 0 0 3 0 0
0.4.24 0 0 3 0 0
0.4.23 0 0 3 0 0
0.4.22 0 0 3 0 0
0.4.21 0 0 3 0 0
0.4.20 0 0 3 0 0
0.4.19 0 0 3 0 0
0.4.18 0 0 3 0 0
0.4.17 0 0 3 0 0
0.4.16 0 0 3 0 0
0.4.15 0 0 4 0 0
0.4.14 0 0 4 0 0
0.4.13 0 0 4 0 0
0.4.12 0 0 4 0 0
0.4.11 0 0 4 0 0
0.4.10 0 0 4 0 0
0.4.9 0 0 4 0 0
0.4.8 0 0 4 0 0
0.4.7 0 0 4 0 0
0.4.6 0 0 4 0 0
0.4.5 0 0 4 0 0
0.4.4 0 0 4 0 0
0.4.3 0 0 4 0 0
0.4.2 0 0 4 0 0
0.4.0 0 0 4 0 0
0.3.4 0 0 4 0 0
0.3.3 0 0 4 0 0
0.3.2 0 0 4 0 0
0.3.1 0 0 4 0 0
0.3.0 0 0 4 0 0
0.2.14 0 0 4 0 0
0.2.13 0 0 4 0 0
0.2.12 0 0 4 0 0
0.2.11 0 0 4 0 0
0.2.10 0 0 4 0 0
0.2.9 0 0 4 0 0
0.2.8 0 0 4 0 0
0.2.7 0 0 4 0 0
0.2.6 0 0 4 0 0
0.2.5 0 0 4 0 0
0.2.4 0 0 4 0 0
0.2.3 0 0 4 0 0
0.2.2 0 0 4 0 0
0.2.1 0 0 4 0 0
0.2.0 0 0 4 0 0
0.1.11 0 0 4 0 0
0.1.10 0 0 4 0 0
0.1.9 0 0 4 0 0
0.1.8 0 0 4 0 0
0.1.7 0 0 4 0 0
0.1.6 0 0 4 0 0
0.1.5 0 0 4 0 0
0.1.4 0 0 4 0 0
0.1.3 0 0 4 0 0
0.1.2 0 0 4 0 0
0.1.1 0 0 4 0 0
0.1.0 0 0 4 0 0
0.0.3 0 0 4 0 0
0.0.2 0 0 4 0 0
0.0.1 0 0 4 0 0

Stability
Latest release:

0.4.45 - This version is safe to use because it has no known security vulnerabilities at this time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

MIT   -   MIT License

Not a wildcard

Not proprietary

OSI Compliant


Apache-2.0   -   Apache License 2.0

Not a wildcard

Not proprietary

OSI Compliant



tar-rs

Documentation

A tar archive reading/writing library for Rust.

# Cargo.toml
[dependencies]
tar = "0.4"

Reading an archive

extern crate tar;

use std::io::prelude::*;
use std::fs::File;
use tar::Archive;

fn main() {
    let file = File::open("foo.tar").unwrap();
    let mut a = Archive::new(file);

    for file in a.entries().unwrap() {
        // Make sure there wasn't an I/O error
        let mut file = file.unwrap();

        // Inspect metadata about the file
        println!("{:?}", file.header().path().unwrap());
        println!("{}", file.header().size().unwrap());

        // files implement the Read trait
        let mut s = String::new();
        file.read_to_string(&mut s).unwrap();
        println!("{}", s);
    }
}

Writing an archive

extern crate tar;

use std::io::prelude::*;
use std::fs::File;
use tar::Builder;

fn main() {
    let file = File::create("foo.tar").unwrap();
    let mut a = Builder::new(file);

    a.append_path("file1.txt").unwrap();
    a.append_file("file2.txt", &mut File::open("file3.txt").unwrap()).unwrap();
}

License

This project is licensed under either of

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.