Expand description
StuffIt (.sit) archive parser, decompressor, and creator.
This crate provides functionality to read and write StuffIt archives, a compression format popular on classic Macintosh systems.
§Supported Formats
- StuffIt 5.0 - The main format with signature at offset 80
- SIT! 1.x - The original StuffIt format
§Compression Methods
- Method 0 - No compression (store)
- Method 13 - LZ77 with Huffman coding (StuffIt native)
- Method 14 - Deflate (limited support)
- Method 15 - Arsenic/BWT (read-only)
§Example
use stuffit::{SitArchive, SitEntry};
// Parse an existing archive
let data = std::fs::read("archive.sit").unwrap();
let archive = SitArchive::parse(&data).unwrap();
for entry in &archive.entries {
println!("{}: {} bytes", entry.name, entry.data_fork.len());
}
// Create a new archive
let mut archive = SitArchive::new();
let mut entry = SitEntry::default();
entry.name = "hello.txt".to_string();
entry.data_fork = b"Hello, World!".to_vec();
archive.add_entry(entry);
let bytes = archive.serialize_compressed().unwrap();
std::fs::write("new_archive.sit", bytes).unwrap();Structs§
- SitArchive
- A StuffIt archive containing multiple entries.
- SitEntry
- A single entry (file or folder) in a StuffIt archive.
Enums§
- Archive
Format - Archive format for decompression method selection
- SitError
- Errors that can occur when working with StuffIt archives.
Constants§
- METHOD_
BWT - Compression method: BWT (Arsenic) - SIT5 only
- METHOD_
DEFLATE - Compression method: Deflate (zlib) - SIT5 only
- METHOD_
HUFFMAN - Compression method: Huffman
- METHOD_
LZW - Compression method: LZW (Lempel-Ziv-Welch)
- METHOD_
RLE - Compression method: RLE (Run Length Encoding)
- METHOD_
SIT13 - Compression method: StuffIt 1.5.1 (LZ77 + Huffman) - Classic and SIT5
- METHOD_
STORE - Compression method: Store (no compression)