Skip to content
/ cra Public

Library for extracting/archiving in multiple formats

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

chrontax/cra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cra

Simple library for extracting/archiving in multiple formats fully in memory

Features

  • effortlessly read archives and iterate over their entries
  • support for 7z, zip and tar
  • fully in memory
  • create archives in any supported format

Usage

cargo add cra

Examples

Read and iterate over archive:

use cra::{ArcReader, ArcEntry};

let mut archive = ArcReader::new(&archive_bytes).unwrap();

for entry in archive {
    match entry {
        ArcEntry::File(name, data) => { /* do something */ }
        ArcEntry::Directory(name) => { /* do something else */ }
    }
}

Create a zip archive with a directory and a file:

use cra::{ArcWriter, ArcEntry, ArcFormat};

let mut writer = ArcWriter::new(Format::Zip);

writer.push(ArcEntry::Directory(String::from("some_dir")));
writer.push(ArcEntry::File(String::from("some_file"), data));

let finished_archive = writer.archive().unwrap(); // Vec<u8>

About

Library for extracting/archiving in multiple formats

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages