archive formats: comments are specs only
This commit is contained in:
1 parent
8bd1a9327c
commit
e792c419d9
36 files changed
+172
-442
No files matched your search
@@ -1,11 +1,7 @@
|
||||
--!strict
|
||||
-- archive/macbinary: MacBinary I, II and III files (a 128-byte header with the name, type / creator, Finder flags,
|
||||
-- dates and fork lengths, then the data and resource forks padded to 128 bytes, then the Get Info comment). II / III
|
||||
-- headers carry a CRC-16/XMODEM (verified: Err.CHECKSUM), III the 'mBIN' signature; MacBinary I is recognised by its
|
||||
-- zero bytes and sane lengths. Decodes to an Archive in the containers/MacFile convention (the data fork is the entry
|
||||
-- `name`, a resource fork the entry `name.rsrc`, with macType / macCreator / finderFlags / created / mtime /
|
||||
-- comment); writes MacBinary III (readable as II) from any Archive's first Mac file or a buffer. Written from the
|
||||
-- MacBinary II / III specifications (Yves Lempereur et al.). Not supported: the secondary header's content (skipped).
|
||||
-- archive/macbinary: MacBinary I / II / III (128-byte header, forks padded to 128, Get Info comment; II / III
|
||||
-- CRC-16/XMODEM, III 'mBIN'), from the MacBinary II / III specs (Lempereur et al.), as containers/MacFile.
|
||||
-- Supports: read, write III. Not supported: the secondary header's content (skipped).
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ requires
|
||||
local Err = require("@rosetta/core/Err")
|
||||
@@ -25,10 +21,9 @@ local MacBinary = {
|
||||
}
|
||||
|
||||
export type DecodeOptions = { maxBytes: number? } -- default 2^30
|
||||
export type EncodeOptions = { name: string? } -- the name of a buffer / string value (default "data")
|
||||
export type EncodeOptions = { name: string? }
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ sniff
|
||||
-- version(b, o, len) -> "III" / "II" / "I" / nil: which MacBinary header sits at o
|
||||
local function version(b: buffer, o: number, len: number): string?
|
||||
if len < 128 then
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user