Crates.io | sqsh-rs |
lib.rs | sqsh-rs |
version | 0.2.0 |
source | src |
created_at | 2024-08-01 04:21:51.268634 |
updated_at | 2024-08-12 02:15:45.936157 |
description | A Rust wrapper around the libsqsh library |
homepage | |
repository | https://github.com/Dr-Emann/sqsh-rs |
max_upload_size | |
id | 1321599 |
size | 136,421 |
A Rust wrapper for the libsqsh library.
This is a simple example that a) prints the content of a file and b) lists the content of a directory.
use std::io::Write;
use sqsh_rs::Archive;
fn example() -> std::io::Result<()> {
let mut archive = Archive::new("tests/data/test.sqsh")?;
let contents: Vec<u8> = archive.read("/subdir/short.file")?;
std::io::stdout().write_all(&contents)?;
let directory = archive.open("/subdir")?;
let mut iter = directory.as_dir()?;
while let Some(entry) = iter.advance()? {
println!("{}", entry.name());
}
Ok(())
}
example().unwrap();