packdir

Crates.iopackdir
lib.rspackdir
version0.1.0
created_at2025-07-04 08:38:06.390422+00
updated_at2025-07-04 08:38:06.390422+00
descriptionEasily embed directories of binary file data
homepage
repositoryhttps://github.com/nobane/packdir
max_upload_size
id1737619
size87,690
(nobane)

documentation

README

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!"
}
Commit count: 0

cargo fmt