#tar-archive #archive

nightly bin+lib extar

Out-of-core tar archive processing

2 releases

Uses old Rust 2015

0.1.1 Apr 7, 2018
0.1.0 Apr 7, 2018

#749 in Compression

BSD-2-Clause

7KB
150 lines

extar

extar is a simple library for reading tar archives. Its intended usage is for out-of-core or external processing, where it is advisable to seek as much as possible to avoid reading and paging.

BufferedTarFile currently exposes one iterator, RawTarEntries. As its name suggests, it yields the bare minimum information that the application may find useful: the header offset, the filename, the file offset, and the file size. The application is responsible for actually reading the file.

extern crate extar;

use extar::*;
use std::fs::{File};
use std::path::{PathBuf};

fn main() {
  let path = PathBuf::new("ILSVRC2012_img_train.tar");
  let file = File::open(&path).unwrap();
  let mut tar = BufferedTarFile::new(file);
  let file_count = tar.raw_entries().count();
  assert_eq!(file_count, 1000);
}

No runtime deps