v2.8.38
What's Changed in v2.8.38
This release makes zip.js resilient to environments without "deflate-raw" support in Compression Streams and to web workers failing silently (e.g. in browser extensions), detects archives with an encrypted central directory, and improves the fidelity of written zip files with other tools.
New features
- New
workerStartupTimeoutoption inconfigure(): if a newly created web worker does not respond within this delay (5 seconds by default), it is terminated and the task runs inline transparently. This recovers from workers failing silently without any error event, e.g. worker scripts blocked by the Content Security Policy. Error events raised by workers which have never responded now also trigger the inline fallback instead of making the task fail. As part of this change, streams are only transferred to workers which have proven responsive, workers post a ready message as soon as their script is loaded, andterminateWorkers()re-enables the detection of web worker support - New
ERR_ENCRYPTED_CENTRAL_DIRECTORYerror:ZipReadernow detects archives with an encrypted central directory (PKWARE SES, e.g. produced by SecureZIP with filename encryption enabled) via the zip64 end of central directory record or the archive extra data record, and throws a clear error instead of failing with a misleading one - Entries encrypted with the strong encryption feature of PKWARE (bit 6 of the general purpose bit flag) are now rejected with
ERR_UNSUPPORTED_ENCRYPTIONinstead ofERR_INVALID_PASSWORDwhen reading
Bug fixes
- The automatic fallback on the embedded deflate/inflate implementation did not work when Compression Streams were unavailable or did not support the
"deflate-raw"format (e.g. Chromium <= 102, Firefox <= 112, older versions of Node.js), unlessuseCompressionStreamwas set tofalse(#669). The WebAssembly module is now initialized when needed, and its initialization is skipped for entries which do not need it (stored entries and entries using a custom codec) - Explicitly passed
externalFileAttributesvalues are now written verbatim, including0on directory entries. ThemsDosCompatibleand unix mode options (unixMode,setuid,setgid,sticky) now only override the bits they represent and preserve the other bits (bits 8 to 15 of the DOS attributes were previously dropped when a unix mode was recomposed)
Behavior changes
- Last modification dates with an odd number of seconds are now rounded up to the next even second in the DOS date/time fields instead of being truncated, consistently with Info-ZIP, 7-Zip, ditto and Windows. The extended timestamp and NTFS extra fields still store the exact date
Full Changelog: v2.8.37...v2.8.38