Documentation
¶
Overview ¶
Package arc provides native decompression and reading for SEA ARC archives.
The core of this arc package was generated by Gemini Flash 3.8 in November 2026, and I have linted, refactored, and cleaned up both the code and comments to be human readable and idomatic Go.
As this is port of a number of public domain and open sourced libraries that were programmed and researched by many people. They have been listed in the included src.md markdown text.
Index ¶
Constants ¶
const ( MethodOldStored byte = 1 // Old format uncompressed MethodStored byte = 2 // Standard uncompressed MethodPacked byte = 3 // Non-repeat RLE MethodSqueezed byte = 4 // Huffman squeezing + RLE MethodCrunched5 byte = 5 // LZW old (uncrunched) MethodCrunched6 byte = 6 // LZW + RLE MethodCrunched7 byte = 7 // LZW + new hash + RLE MethodCrunched8 byte = 8 // Dynamic LZW + RLE MethodSquashed byte = 9 // Squashed (13-bit dynamic LZW) )
Variables ¶
var ( ErrCorruptLZW = errors.New("corrupted crunched archive data") ErrCRCMismatch = errors.New("crc-16 mismatch") ErrFormat = errors.New("not a valid arc archive") ErrInvalidTree = errors.New("file has an invalid decode tree") ErrUnsupportedMethod = errors.New("unsupported arc compression method") )
Functions ¶
func CRC16 ¶
CRC16 calculates the CRC-16 checksum used by SEA ARC archives using the 0xA001 reversed polynomial.
func Uncrunch ¶
Uncrunch decompresses data compressed with the following SEA ARC methods:
- Method 8: Dynamic Lempel-Zev packing with adaptive reset
- Method 9: Squashing
There is one bool argument, squash.
- To use method 8: squash=false
- To use method 9: squash=true
func UncrunchLZW ¶
UncrunchLZW decompresses data compressed with the following SEA ARC methods:
- Method 5: Lempel-Zev packing of repeated strings (old style)
- Method 6: Lempel-Zev packing of repeated strings (new style)
- Method 7: Lempel-Zev Williams packing with improved hash function
There are two bool arguments, william and rle.
- To use method 5, william=false, rle=false
- To use method 6, william=false, rle=true
- To use method 7, william=true, rle=true
Types ¶
type File ¶
type File struct {
Header
// contains filtered or unexported fields
}
File represents a file entry within an ARC archive.
type Header ¶
type Header struct {
Name string
Method byte
CompressedSize uint32
UncompressedSize uint32
Modified time.Time
CRC uint16
}
Header represents a file header inside an ARC archive.
type Reader ¶
type Reader struct {
Files []*File
// contains filtered or unexported fields
}
Reader provides read access to the entries of an ARC archive.
func OpenReader ¶
OpenReader opens the named ARC file and returns a Reader.