node-stream-zip 1.15.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -195,6 +195,7 @@ zip.on('entry', entry => {
195
195
  You can pass these options to the constructor
196
196
  - `storeEntries: true` - you will be able to work with entries inside zip archive, otherwise the only way to access them is `entry` event
197
197
  - `skipEntryNameValidation: true` - by default, entry name is checked for malicious characters, like `../` or `c:\123`, pass this flag to disable validation errors
198
+ - `nameEncoding: 'utf8'` - encoding used to decode file names, UTF8 by default
198
199
 
199
200
  ## Methods
200
201
 
@@ -864,13 +864,17 @@ class ZipEntry {
864
864
  this.crc = data.readUInt32LE(consts.LOCCRC) || this.crc;
865
865
  // compressed size
866
866
  const compressedSize = data.readUInt32LE(consts.LOCSIZ);
867
- if (compressedSize && compressedSize !== consts.EF_ZIP64_OR_32) {
868
- this.compressedSize = compressedSize;
867
+ if (
868
+ compressedSize &&
869
+ compressedSize !== consts.EF_ZIP64_OR_32 &&
870
+ compressedSize !== this.compressedSize
871
+ ) {
872
+ throw new Error('Invalid compressed size');
869
873
  }
870
874
  // uncompressed size
871
875
  const size = data.readUInt32LE(consts.LOCLEN);
872
- if (size && size !== consts.EF_ZIP64_OR_32) {
873
- this.size = size;
876
+ if (size && size !== consts.EF_ZIP64_OR_32 && size !== this.size) {
877
+ throw new Error('Invalid size');
874
878
  }
875
879
  // filename length
876
880
  this.fnameLen = data.readUInt16LE(consts.LOCNAM);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-stream-zip",
3
- "version": "1.15.0",
3
+ "version": "1.16.0",
4
4
  "description": "node.js library for reading and extraction of ZIP archives",
5
5
  "keywords": [
6
6
  "zip",
@@ -35,10 +35,13 @@
35
35
  "node": ">=0.12.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@types/node": "^14.14.6",
39
- "eslint": "^7.19.0",
38
+ "@eslint/js": "^10.0.1",
39
+ "@types/node": "^26.1.1",
40
+ "eslint": "^10.7.0",
41
+ "globals": "^17.7.0",
40
42
  "nodeunit": "^0.11.3",
41
- "prettier": "^2.2.1"
43
+ "prettier": "^3.9.6",
44
+ "typescript": "^7.0.2"
42
45
  },
43
46
  "funding": {
44
47
  "type": "github",