Bounded 7z archive reading, verification and extraction for MoonBit applications
moon add Wyh123456559/moon7z@0.1.0moon update
moon run app -- list corpus/lzma2-solid.7z
moon run app -- list --json corpus/lzma2-solid.7z
moon run app -- test corpus/lzma2-solid.7z
moon run app -- test --json corpus/lzma2-solid.7z
moon run app -- diff --json corpus/copy-plain.7z corpus/lzma2-solid.7z
moon run app -- read corpus/lzma2-solid.7z 6
moon run app -- read-range corpus/bcj-lzma2.7z 0 0 64
moon run examples/import -- corpus/lzma2-solid.7z
moon run examples/preview -- corpus/lzma2-solid.7z
moon run examples/header-scan -- corpus/lzma2-solid.7z
moon run app -- test corpus/delta-solid.7z
moon run app -- test --require-member-crcs corpus/delta-solid.7z
moon run app -- test corpus/bcj-lzma2.7z
moon run app -- test corpus/arm64-lzma2.7z
moon run app -- extract --contents-only corpus/delta-solid.7z . imported-audio
moon run app -- extract --contents-only corpus/lzma2-solid.7z . imported-package
moon run app -- extract-selected --contents-only corpus/lzma2-solid.7z . selected-manifest 6let archive = @archive.Archive::open(bytes)
for item in archive.extract_all() {
// item.entry retains the original name, kind, CRC and optional metadata.
// item.bytes contains the file contents; directory contents are empty.
consume(item.entry, item.bytes)
}| Capability | Current behavior |
|---|---|
| Container | Single-volume; real fixtures cover 0.3 and 0.4; header minors 0–4 accepted; signature at byte zero |
| Embedded/SFX | Bounded memory import and UInt64 positioned file/volume discovery, known offsets and exact envelope views; SDK and 4 GiB+ evidence |
| Split volumes | Explicit ordered numeric sets, varying sizes, cumulative input/count limits and encrypted/plain real fixtures; workflow |
| Seekable sources | UInt64 positioned reads, on-demand folders and composed numeric volumes; actual archive above 4 GiB |
| Codecs | Copy, LZMA, LZMA2, PPMd7, BZip2, raw DEFLATE, BCJ2 four-input branch reconstruction |
| Filters | Delta (distance 1–256), x86 BCJ, ARM64, RISC-V, ARM, ARM-Thumb, PowerPC, IA64, SPARC, Swap2/Swap4 |
| Coder graph | Bounded acyclic graphs of supported unary coders and four-input BCJ2; explicit physical input mappings |
| Headers | Plain/compressed headers; additional streams and external names/times/attributes/folder definitions |
| Encryption | 7z AES-256/SHA-256 password reading for headers/data; bounded cumulative derivation work |
| Members | Solid and separate folders, directories, empty files, UTF-16 names |
| Integrity | Start/next header, available packed/folder/member CRC-32 |
| Metadata | Creation/access/modification FILETIME, UInt64 start position and original Windows/POSIX attribute word retained |
| File semantics | Anti-items, symbolic links, reparse points and special files inspected as data; unsafe filesystem restoration refused |
| File properties | Unknown FilesInfo records retain ordered UInt64 IDs and opaque bytes; exporting a nonempty selection requires understood semantics |
| Archive properties | Original ordered UInt64 IDs and opaque bytes, including duplicate IDs and empty values |
| Resources | Configurable input/header/output/dictionary/member/coder/intermediate-output limits |
moon run checks/verify.mbtx -- wasm
moon run checks/verify.mbtx -- wasm-gc
moon run checks/verify.mbtx -- js
moon run checks/verify.mbtx -- nativeInstall
Download zipBounded 7z archive reading, verification and extraction for MoonBit applications