| Crates.io | macbinary-rs |
| lib.rs | macbinary-rs |
| version | 0.2.0 |
| created_at | 2026-01-25 10:31:35.848701+00 |
| updated_at | 2026-01-25 17:13:41.838547+00 |
| description | Transparent access to MacBinary-encoded files |
| homepage | |
| repository | https://codeberg.org/cyco/macbinary-rs.git |
| max_upload_size | |
| id | 2068509 |
| size | 48,976 |
This crate aims to provide transparent access to macbinary files following the documentation at https://github.com/mietek/theunarchiver/wiki/MacBinarySpecs
The intended usage is as follows
use macbinary::{MacBinary, Error, Version};
match macbinary::probe_file("./sample-file.sit") {
Ok(Version::None) => {}
Ok(Version::MacBinaryI) => {}
Ok(Version::MacBinaryII) => {}
Ok(Version::MacBinaryIII) => {}
Err(e) => eprintln!("Could not determine format of file: {:?}", e),
}
use macbinary::Fork;
match macbinary::open_file("./sample-file.sit") {
Ok(mut file) => {
println!("File: {}", file.name());
println!("Type: {}/{}", file.creator_code(), file.type_code());
let mut reader = file.open_fork(Fork::Data).unwrap();
// .. read data from reader
},
Err(e) => eprintln!("Could not open file {:?}", e)
}
If file is not a macbinary, it will return sensible defaults for all fields, provide a transparent reader for the data fork and an empty reader for the resource fork.
At the moment the crate does not actually try to locate the resource fork if the opened file is not MacBinary encoded.
Checksum verification is not implemented.