v2.8.47
What's Changed in v2.8.47
New features
- New
signCentralDirectoryoption inZipWriter#close()to sign zip files. The function receives the raw data of the central directory records and returns the data of a digital signature record, e.g. a PKCS#7 signature, written between the central directory and the end of central directory record. The signature is exposed by the newdigitalSignatureproperty ofZipReader, along with the newdirectoryOffsetanddirectoryLengthproperties to locate the signed data and verify it. zip.js stores the data as-is and does not implement the signature computation itself - New
decryptCentralDirectoryoption inZipReaderto read zip files with an encrypted central directory, as defined in the Strong Encryption Specification of the ZIP format specification. The function receives the raw data stored in place of the central directory and the encryption metadata exposed in aDirectoryEncryptionInfoobject, and returns the decrypted central directory records. Without this option, reading such zip files throws anERR_ENCRYPTED_CENTRAL_DIRECTORYerror. zip.js provides the encrypted data and the related metadata but does not implement the decryption itself - All the user-facing error message constants are now exported, e.g.
ERR_INVALID_UID,ERR_INVALID_MSDOS_ATTRIBUTES,ERR_ENTRY_EXISTS,ERR_UNSUPPORTED_CRYPTO_APIandERR_WORKER_STARTUP_TIMEOUT. This allows comparingerror.messagewith the constants instead of hardcoding the messages
Other changes
- Improved browser testing, thanks to @danny0838 (#672): module import errors are now reported in the test results, and the new
withStreamsPolyfillURL parameter runs the test suite with web-streams-polyfill on browsers missingTransformStream
Full Changelog: v2.8.46...v2.8.47