binhex
This crate provides a rust implementation for reading BinHex 4 files.
Introduced in 1995, the BinHex 4 format gained popularity in the early 90s among Macintosh users, as it combined Finder info of a file with its data and resource forks and wrapped everything up in a format that could easily and safely be shared via E-Mail and users on message boards.
As BinHex files are just ASCII text files, they can be hard to identify. If
present, the hqx file extension is a good indicator, otherwise the whole file
has to be searched progressively for the header indicating the start of encoded data.
The crate should be used by creating an [Archive] struct from an existing [io::Read],
like a [fs::File] or [io::Cursor].
use ;
use Read;
use fourcc;
// Open BinHex file
let mut archive = open.unwrap;
// Read whole file and verify checksums
assert!;
// Make sure we got the correct file
assert_eq!;
assert_eq!;
// Read the data fork
let mut buffer = vec!;
let mut data_fork_reader = archive.data_fork.unwrap;
data_fork_reader.read_exact.unwrap;
// Read the resource fork
let mut buffer = vec!;
let mut rsrc_fork_reader = archive.data_fork.unwrap;
rsrc_fork_reader.read_exact.unwrap;