ws-arch2-cab: archive/cab (MSCF read: stored / MSZIP folders with the carried-over deflate dictionary, reserve areas, checksums, attributes, UTF-8 names, spanned files UNSUPPORTED; write: one stored / MSZIP folder) vs cabextract / gcab / 7z; Deflate.inflate gains an optional preset dictionary (5th argument, Inflate.raw 7th; backward compatible)

This commit is contained in:
4DBug committed 2026-10-31 15:37:25 -05:00
1 parent 53b41c7275
commit 825c45b03c
10 files changed
+851 -4

No files matched your search

+1
View File
@@ -70,6 +70,7 @@ is tested under both runtimes (luau `--codegen -O2` and LuaJIT through the build
| archive | binhex | .hqx .hcx | yes | yes | forks: true | `tests/archive/binhex.luau` |
| archive | br | .br | yes | - | stream: true | `tests/archive/br.luau` |
| archive | bz2 | .bz2 .tbz2 .tbz | yes | - | stream: true | `tests/archive/bz2.luau` |
| archive | cab | .cab | yes | yes | methods: "store", "mszip" | `tests/archive/cab.luau` |
| archive | cpio | .cpio | yes | yes | variants: "newc", "crc", "odc", "bin" | `tests/archive/cpio.luau` |
| archive | d64 | .d64 .d71 .d81 | yes | yes | variants: "d64", "d71", "d81" | `tests/archive/d64.luau` |
| archive | fat | .img .ima .vfd .flp .fat | yes | yes | variants: "fat12", "fat16", "fat32" | `tests/archive/fat.luau` |
+20
View File
@@ -272,6 +272,25 @@ assert(by["bin"].dir and by["bin/run.sh"].mode == 493 and by["run"].link == "bin
assert(F.archive.load(isoBytes, { prefer = "joliet" }).meta.iso.tree == "joliet")
```
## Microsoft Cabinet
Cabinet files (`.cab`) read with stored, MSZIP, LZX and Quantum folders; each data block's checksum is checked when
a file of its folder is read. Entries carry the MS-DOS `attributes` (`readonly`, `executable`), `utf8` (the name flag)
and `folder`; DOS times are local times without a zone, read as UTC. Files continued from or into another cabinet of
a set read as `UNSUPPORTED`. Writing makes one folder, MSZIP (default, `level`) or stored (`compression = "none"`):
```luau
local cab = assert(F.archive.load(cabBytes))
assert(cab.format == "cab" and cab.meta.folders[1].method == "mszip")
local by = {}
for _, e in cab:list() do
by[e.name] = e
end
assert(by["bin/tool.dll"].size == 16384 and by["readme.txt"].mtime == 1767225600)
local out = assert(F.save(cab, nil, { format = "cab", compression = "none" }))
assert(F.archive.load(out):list()[1].method == "store")
```
## Formats
| Format | Read | Write | Notes |
@@ -290,6 +309,7 @@ assert(F.archive.load(isoBytes, { prefer = "joliet" }).meta.iso.tree == "joliet"
| compress (`.Z`, `.taz`) | yes | yes | single stream; 9..16-bit LZW |
| LZ4 (`.lz4`) | yes | yes | single stream; frames, legacy frames, XXH32 checks; no dictionaries |
| ISO 9660 (`.iso`) | yes | - | Joliet, Rock Ridge, El Torito, multi-extent; no UDF |
| Cabinet (`.cab`) | yes | yes | stored / MSZIP / LZX / Quantum (read), stored / MSZIP (write); no spanned files |
Full capability list: [FORMATS.md](../FORMATS.md).