MCPcopy Index your code
hub / github.com/composefs/tar-rs

github.com/composefs/tar-rs @0.4.46

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.4.46 ↗ · + Follow
400 symbols 1,767 edges 19 files 174 documented · 44%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

tar-rs

Documentation

A tar archive reading/writing library for Rust.

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

Reading an archive

```rust,no_run 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

```rust,no_run
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

  • Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or https://opensource.org/license/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.

Extension points exported contracts — how you extend this code

SeekRead (Interface)
(no doc) [1 implementers]
src/archive.rs
SeekWrite (Interface)
(no doc) [1 implementers]
src/builder.rs

Core symbols most depended-on inside this repo

path
called by 124
src/entry.rs
set_cksum
called by 64
src/header.rs
set_size
called by 61
src/header.rs
set_path
called by 61
src/header.rs
next
called by 59
src/pax.rs
into_inner
called by 53
src/archive.rs
append
called by 53
src/builder.rs
set_entry_type
called by 52
src/header.rs

Shape

Method 201
Function 163
Class 29
Enum 5
Interface 2

Languages

Rust100%

Modules by API surface

src/header.rs109 symbols
tests/all.rs83 symbols
src/builder.rs50 symbols
src/entry.rs36 symbols
src/archive.rs28 symbols
src/entry_type.rs24 symbols
xtask/src/revdep_test.rs15 symbols
tests/entry.rs14 symbols
tests/header/mod.rs13 symbols
src/pax.rs11 symbols
src/error.rs6 symbols
xtask/src/main.rs2 symbols

For agents

$ claude mcp add tar-rs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page