What's Changed in v2.11.0
Breaking changes
ERR_INVALID_CRC32andERR_INVALID_AUTHENTICATION_CODEnow hold distinct values,"Invalid CRC32"and"Invalid authentication code". Both were aliases ofERR_INVALID_SIGNATUREsince v2.8.44, added as aliases so the two errors could be told apart later without breaking the code comparing them at the time.ERR_INVALID_SIGNATUREis removed, the term naming a CRC-32 check and an AES authentication code, neither of which is a signature. Code comparing an error message to it must now compare to the constant naming the check that failed- The
externalFileAttributeandinternalFileAttributenames are removed, from the entry properties and from the writer options. They were renamed toexternalFileAttributesandinternalFileAttributesin January 2025 and kept as aliases since. The other names deprecated in the 2.8 releases are kept. The minified files shrink by 354 bytes
Bug fixes
- Deflate64 entries are no longer refused when a match at least as long as the 64KB output buffer of the WebAssembly codec starts on its boundary. The codec then fills a whole buffer without consuming any input, which was read as the end of the data: the rest of the chunk was dropped, and the entry failed with a
Z_BUF_ERRORat the default chunk size, or with an invalid uncompressed size when the chunks were small enough for the loss to pass unnoticed until the end. Only Deflate64 allows such a match, its maximum length being 65538 bytes against the 258 of Deflate, and 7-Zip does not produce one, its Deflate64 encoder capping the matches at 257 bytes. The JavaScript codec was unaffected - The JavaScript codec no longer corrupts the data when a match wraps around the end of the sliding window and ends inside it. The bytes were then copied from the output buffer instead of the window, which needs more than 32KB already decompressed and a match straddling the wrapping point.
deflateandgzipreported the corruption as an invalid checksum,deflate-rawreturned the expected number of bytes with a few of them wrong. The entries of a zip file are read asdeflate-rawandcheckCrc32is not set by default, so the wrong bytes were returned with no error at all. The codec is the one theindex-nativeand legacy builds use, including to read Deflate64
Performance
- The WebAssembly codec is now built from Chromium's fork of zlib, which reads 20% faster and writes 6 to 8% faster. The compressed output is unchanged, byte for byte, at every level. The module grows by 1592 bytes. The codec is used when the
CompressionStreamAPI is unavailable or turned off with theuseCompressionStreamoption, and always when reading Deflate64 (#677)
Documentation
- The
keepOrderoption no longer claims that setting it totrueimproves the use of web workers, which is the opposite of what it does. Keeping the order writes the entries one after another, so concurrent calls toadd()compress one entry at a time. The remark now says so and points tobufferedWrite, which restores the concurrency while still keeping the order
Tests and continuous integration
- New test covering a Deflate64 match starting on the boundary of the output buffer, in both codecs
- New test covering a match wrapping around the end of the sliding window of the JavaScript codec, in both codecs
- The test pinning the attribute names now covers the precedence of the entry options over the writer options instead of the removed aliases