@ai-ecoverse/wasm-zip
Info-ZIP zip 3.0 and unzip 6.0 for
slicc's wasm realm.
pnpm add -g @ai-ecoverse/wasm-zip
zip out.zip file.txt
unzip -l out.zip
zip -Trunsunzipitself, without a shell. A-TTcommand is a shell command, so it needs one (@ai-ecoverse/wasm-bash).- Non-ASCII names are UTF-8.
zipsets the UTF-8 flag on them, andunzipshows them and reads Info-ZIP's Unicode path field. - The realm's file names are UTF-8. An entry whose name isn't (an old
Latin-1 or CP437 archive without a Unicode path) is not extracted under a
changed name:
unzipsayscannot create <name>/Illegal byte sequenceand exits 50.unzip -pstill streams its bytes. Such entries are refused rather than renamed because a substituted name can collide with another entry or an existing file and silently overwrite it. unzip -%(opt-in) extracts those entries under an escaped name instead. Each byte of the name outside a valid UTF-8 sequence becomes%XX(two upper-case hex digits), and a%in that name becomes%25; a name that is valid UTF-8 is left exactly as it is. Socaf\xe9.txtis written ascaf%E9.txtand100%\xe9.txtas100%25%E9.txt, and unzip printsescaped: <path>for each one. To get the stored name back, replace every%XXin a reported path with the byte XX, e.g. in Pythonurllib.parse.unquote_to_bytes(name). An escaped name never replaces anything: if its path exists already (on disk, or from an earlier entry), the entry is refused by name, and a later entry whose path an escaped entry took is refused too. unzip then exits 2, also under-oand-n. Symlink targets are not escaped, so a link whose target isn't UTF-8 is still refused.- A Unix entry with the PKWARE verification bit (internal attribute bit 2) carries a checksum where its mode would be, so it is extracted as a regular file with 0666 (0444 if marked read-only) less your umask, not with the mode 000 that Debian's handling of the bit leaves.
zip - … > fileandzip - … | …write valid archives, andzip -s 0merges split archives (zip -s 1m) back with every byte.zipinfois unzip's zipinfo mode, the same asunzip -Z.- unzip carries Debian's unzip 6.0 security patches.