Skip to content

nobane/packdir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

packdir

Easily embed a directory of files into a rust program, with xz and gzip compression support. Lazy unpack and cache files via random access, or inflate them all up front.

Usage

In your_crate/embed/hello.txt:

Hello World!

In your_crate/build.rs:

fn main() {
    packdir::pack("./embed", "embed", packdir::Xz::best()).expect("embed dir");
}

In your_crate/src/main.rs:

fn main() {
    let mut embed = packdir::unpack!("embed");

    println!("entires: {:?}", embed.entries()); // entries: ["hello.txt"]

    let content = embed.get("hello.txt");

    println!("content = {content:?}"); // content = "Hello World!"
}

About

Easily embed a directory of files into a rust program, with xz and gzip compression support.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages