| Crates.io | packdir |
| lib.rs | packdir |
| version | 0.1.0 |
| created_at | 2025-07-04 08:38:06.390422+00 |
| updated_at | 2025-07-04 08:38:06.390422+00 |
| description | Easily embed directories of binary file data |
| homepage | |
| repository | https://github.com/nobane/packdir |
| max_upload_size | |
| id | 1737619 |
| size | 87,690 |
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.
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!"
}