| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| README.md | 2026-09-30 | 3.4 kB | |
| v2.22.0 source code.tar.gz | 2026-09-30 | 4.2 MB | |
| v2.22.0 source code.zip | 2026-09-30 | 4.7 MB | |
| Totals: 3 Items | 8.9 MB | 1 | |
What's Changed in v2.22.0
appendZip()
- New
readerOptionsoption: the options of theZipReaderwhich reads the zip file to copy. The zip file used to be read with the default options only, so a zip file the reader rejects by default could not be appended as-is. SetfilenameValidationorstrictnessto copy the entries of a zip file holding unsafe or unusual filenames,filenameEncodingto decode the filenames the duplicate check and thefilteroption see, andpasswordto letfilterread the data of encrypted entries withgetData(). The bytes of the entries are copied as-is whatever the options are. A value which is neither an object nor unset throwsERR_INVALID_READER_OPTIONS, now exported by the core builds as well - The
filterfunction receives a second argument: the entry of the current zip which has the same filename, asadd()or a previousappendZip()call left it, orundefinedwhen there is none. It is the way to apply a duplicate filename policy, since keeping both entries throwsERR_DUPLICATED_NAME: return!existingEntryto keep the entry of the current zip, callremove(existingEntry)and returntrueto replace it, or comparecrc32,uncompressedSizeorlastModDateto decide. A removed entry leaves its bytes in the output, asremove()always did, and a strictZipReaderreports them as prepended data.remove()now accepts theEntryMetaDatareturned byadd()in its type declaration - The zip file being copied is closed when
filterthrows, and the documentation ofappendZip()now states thatadd()calls made whilefilterruns are written before the copied entries, while those made once the copy has started are written after it - The entries passed to
filterare not modified any more once the callback has returned: the copy used to rewrite theiroffsetwith the position in the output and to hang the fields of the rebuilt central directory on them - A zip file whose own entries share a filename is rejected with
ERR_DUPLICATED_NAMEbefore anything is written, as before, and this is now documented: aZipWriterholds one entry per filename, so thefilteroption is the way to keep one of them
Bug fixes
new ZipReader(reader, null)reads the zip file with the default options instead of failing with aTypeErrorwhen the entries are read; anulloptions argument is treated as unset, like the other falsy values everywhere in the API
Removed
- The
transferStreamsconfiguration option is removed. It had been a no-op since v2.19.0, when the path transferring the streams to the web workers was removed: the data always crosses the worker boundary chunk by chunk.configure()ignores the key silently, so a call still passing it keeps working; TypeScript reports the key as unknown inWorkerConfiguration, delete it from the call
Tests
- A real byte overlap between two entries, stretched consistently in the local file header and the central directory record so that the default
checkLocalDirectorycheck passes, is detected withcheckOverlappingEntrywhatever the order the entries are read in; the existing overlap fixtures overlapped only through a phantom data descriptor
Full Changelog: https://github.com/gildas-lormeau/zip.js/compare/v2.21.0...v2.22.0
Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com