| Crates.io | erofs-rs |
| lib.rs | erofs-rs |
| version | 0.1.0 |
| created_at | 2026-01-14 15:18:24.486079+00 |
| updated_at | 2026-01-14 15:18:24.486079+00 |
| description | A pure Rust library for reading EROFS (Enhanced Read-Only File System) images |
| homepage | |
| repository | https://github.com/Dreamacro/erofs-rs |
| max_upload_size | |
| id | 2043013 |
| size | 43,108 |
A pure Rust library for reading and building EROFS (Enhanced Read-Only File System) images.
Note: This library aims to provide essential parsing and building capabilities for common use cases, not a full reimplementation of erofs-utils.
use std::fs::File;
use std::io::Read;
use memmap2::Mmap;
use erofs_rs::EroFS;
fn main() -> erofs_rs::Result<()> {
let file = File::open("system.erofs")?;
let mmap = unsafe { Mmap::map(&file) }?;
let fs = EroFS::new(mmap)?;
// Read file
let mut file = fs.open("/etc/os-release")?;
let mut buf = Vec::new();
file.read_to_end(&mut buf)?;
// List directory
for entry in fs.read_dir("/usr/bin")? {
println!("{}", entry?.dir_entry.file_name());
}
Ok(())
}
# Dump superblock info
erofs-cli dump image.erofs
# List directory
erofs-cli inspect -i image.erofs ls /
# Read file content
erofs-cli inspect -i image.erofs cat /etc/passwd
# Convert to tar
erofs-cli convert image.erofs -o out.tar
walk_dir)mkfs.erofs equivalent)MIT OR Apache-2.0