A Rust library (stuffit) and CLI tool for reading and writing StuffIt (.sit) archives.
Note: This library targets the classic StuffIt format (
.sit) used by StuffIt 1.x through 5.x. The newer StuffIt X format (.sitx, StuffIt 7.0+) is not yet supported.
Disclaimer: This project is not affiliated with, endorsed by, or connected to Smith Micro Software, Allume Systems, or the original StuffIt developers. "StuffIt" is used here as a descriptive term for the file format.
StuffIt was a popular compression format on classic Macintosh systems. This crate provides functionality to parse existing archives and create new ones, with support for the dual-fork file system used by classic Mac OS.
- Parse StuffIt 5.0 archives - Read files compressed with StuffIt 5.x
- Parse SIT! 1.x archives - Support for the original StuffIt format
- Create new archives - Build StuffIt 5.0 compatible archives
- Method 13 compression - LZ77 with Huffman coding (native StuffIt)
- Dual-fork support - Preserve both data and resource forks
- Finder metadata - File types, creator codes, and Finder flags
| Method | Name | Read | Write |
|---|---|---|---|
| 0 | None (store) | ✓ | ✓ |
| 13 | LZ77+Huffman | ✓ | ✓ |
| 14 | Deflate | ✓ | ✓ |
| 15 | Arsenic/BWT | ✓ | ✗ |
use stuffit::{SitArchive, SitEntry};
// Parse an existing archive
let data = std::fs::read("archive.sit")?;
let archive = SitArchive::parse(&data)?;
for entry in &archive.entries {
println!("{}: {} bytes (data), {} bytes (rsrc)",
entry.name,
entry.data_fork.len(),
entry.resource_fork.len()
);
}
// Create a new archive
let mut archive = SitArchive::new();
let entry = SitEntry {
name: "hello.txt".to_string(),
data_fork: b"Hello, World!".to_vec(),
file_type: *b"TEXT",
creator: *b"ttxt",
..Default::default()
};
archive.add_entry(entry);
// Write uncompressed
let bytes = archive.serialize()?;
// Or write with compression
let compressed = archive.serialize_compressed()?;The crate includes a command-line tool (stuffit) for working with StuffIt archives.
# Simple list (just names)
stuffit list archive.sit
# Detailed list with metadata
stuffit list archive.sit --verbosestuffit extract archive.sit -o output_dir# Compressed (default, method 13)
stuffit archive -o output.sit file1.txt folder/
# Uncompressed
stuffit archive -o output.sit file1.txt folder/ -m 0-v, --verbose- Show detailed progress or information-o, --output- Specify output path-m, --method- Compression method (0=none, 13=compressed)
On macOS, the tool automatically handles:
- Resource forks - Stored in
file/..namedfork/rsrc - Finder metadata - File types, creators, and flags via
com.apple.FinderInfo - Custom folder icons - The
Icon\rfile and folder flags
# Install from crates.io
cargo install stuffit
# Or build from source
git clone https://github.com/benletchford/stuffit-rs
cd stuffit-rs
cargo build --release# Library only
cargo build --no-default-features
# With CLI tool (default)
cargo buildLicensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
- The Unarchiver - Reference implementation
- StuffIt File Format - Original documentation