• Stars
    star
    551
  • Rank 77,602 (Top 2 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created almost 10 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Tar file reading/writing for Rust

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.

More Repositories

1

rust-ffi-examples

FFI examples written in Rust
Makefile
1,160
star
2

toml-rs

A TOML encoding/decoding library for Rust
Rust
994
star
3

curl-rust

Rust bindings to libcurl
Rust
982
star
4

futures-await

Rust
733
star
5

ssh2-rs

Rust bindings for libssh2
Rust
450
star
6

cargo-vendor

Archived as subcommand is now part of Cargo itself
Rust
260
star
7

wasm-gc

gc-sections for wasm
Rust
247
star
8

coz-rs

Rust support for the coz Causal profiler, code now lives upstream -- https://github.com/plasma-umass/coz
Rust
211
star
9

tokio-process

Asynchronous process management for tokio
Rust
146
star
10

tokio-curl

Asynchronous HTTP client built on libcurl
Rust
108
star
11

filetime

Accessing file timestamps in a platform-agnostic fashion in Rust
Rust
108
star
12

tokio-signal

Unix signal handling for tokio
Rust
87
star
13

rlibc

77
star
14

bzip2-rs

libbz2 (bzip2 compression) bindings for Rust
C
77
star
15

dlmalloc-rs

dlmalloc ported into Rust
C
75
star
16

openssl-src-rs

Source code and logic to build OpenSSL from source
Rust
66
star
17

xz2-rs

Bindings to liblzma in Rust (xz streams in Rust)
Rust
65
star
18

wait-timeout

Waiting on a child process with a timeout in Rust
Rust
57
star
19

green-rs

Green Tasks for Rust
Rust
54
star
20

openssl-probe

Rust
51
star
21

socks5-rs

Implementation of a socks5 proxy server in Rust
Rust
49
star
22

jba

Javascript Gameboy
JavaScript
42
star
23

bufstream

A buffered I/O stream for Rust
Rust
30
star
24

wasm-sodium

PoC of libsodium being used in Rust on wasm32-unknown-unknown
Rust
25
star
25

wasm-interface-types-polyfill

Polyfill for WebAssembly Interface Types
Rust
25
star
26

port-of-rust

Docker images for Rust projects
Shell
24
star
27

splay-rs

A splay tree implementation written in Rust
Rust
24
star
28

talks

Talks I've given at various conferences
18
star
29

debug-cell

Debug RefCell which keeps track of stack traces in debug mode
Rust
18
star
30

link-config

Rust
17
star
31

nghttp2-rs

Rust
17
star
32

rack-shibboleth

Shibboleth meets Ruby and Rack
Ruby
17
star
33

rust-wasm-benchmark

JavaScript
14
star
34

cargo-fancy

Fancy output for Cargo
Rust
13
star
35

wbg-rand

Random numbers for wasm32-unknown-unknown in Rust
Rust
12
star
36

ipc-rs

IPC primitives for Rust
Rust
11
star
37

rustfmt-wasm

Dockerfile
9
star
38

oa-pubcookie

OmniAuth strategy when using Pubcookie or CMU's WebISO
Ruby
8
star
39

homebrew-formula

Ruby
7
star
40

paste

JS + CSS dependency managament for Rails 3
Ruby
7
star
41

rack-pubcookie

Pubcookie finally isn't tied to Apache, now it's in Ruby!
Ruby
7
star
42

cfg-specialize

Rust
7
star
43

rustc-auto-publish

Rust
6
star
44

tokio-named-pipes

Windows named pipes bindings for tokio
Rust
6
star
45

l4c

Rust
6
star
46

memset-nt

Non-temporal memset for RUst
Rust
6
star
47

wasm-cross-lang-lto-example

Shell
6
star
48

glimmer-experiments

Rust
6
star
49

xxhash2-rs

Rust bindings to libxxhash
Rust
5
star
50

witx-async-demo

Rust
5
star
51

hacku

hacku
JavaScript
4
star
52

socparse

Ruby
4
star
53

example-wasi-tools

Rust
4
star
54

differential-wasmtime-v8

Rust
4
star
55

golden-circle

The Golden Circle website registration and grading application
JavaScript
4
star
56

openssl-sys

Rust
4
star
57

futures-await-syn

futures-await temporary fork of dtolnay/syn
Rust
3
star
58

oddit

Oddit - Auditing application for CMU students
Ruby
3
star
59

rust-fannkuch-js-and-wasm

Rust
3
star
60

my-awesome-wasi-proposal

3
star
61

futures-spsc

Single-producer, single-consumer queues for Rust futures
Rust
3
star
62

rust-travis-deploy

Moved to https://github.com/rust-lang/simpleinfra
Rust
3
star
63

stamp-rs

Rust
2
star
64

twocan

Collaborative Crosswords!
Ruby
2
star
65

www

HTML
2
star
66

eeyore

Label tagging bot
Rust
2
star
67

io2

Rust
2
star
68

cpu-usage-over-time

Rust
2
star
69

complicated-linkage-example

Rust
2
star
70

fargo

A DC protocol implementation in Ruby
Ruby
2
star
71

rustjob

Rust
2
star
72

conduit-git-http-backend

Conduit handler for running `git http-backend`
Rust
2
star
73

tls-rs

Thread-Local-Storage (TLS) for Rust
2
star
74

rbindgen

Rust
2
star
75

movies

A proposed solution to the Movie Chain Runner problem
C
2
star
76

rustc-compile-time-analyze

Rust
1
star
77

dcfs

A FUSE filesystem over the DC protocol
Ruby
1
star
78

example-wasi-abi-up-to-date

JavaScript
1
star
79

wasmtime-unwinding-timings

Rust
1
star
80

futures-tools

1
star
81

longjmp-repro

Rust
1
star
82

ars

ar in Rust
Rust
1
star
83

weird-proc-macro-spans

Rust
1
star
84

recipe_box

Recipe Box as a web application
Ruby
1
star
85

bors2

WIP
Rust
1
star
86

crates.io-index-2018-09-20-squashed

Shell
1
star
87

webpush-server-proof-of-concept

Rust
1
star
88

wasm-component-ld

Command line linker for creating WebAssembly components
Rust
1
star
89

futures-await-quote

futures-await temporary fork of dtolnay/quote
Rust
1
star
90

cargo-apply

Rust
1
star
91

rustc-test

Extraction of libtest from rustc
Rust
1
star
92

cohort_radio

The best radio ever
Ruby
1
star
93

wasm64-timings

Rust
1
star
94

binaryen

Compiler infrastructure and toolchain library for WebAssembly, in C++
Assembly
1
star
95

gnome-class

Some experimental macros for GNOME integration
Rust
1
star