node-stream-zip 1.14.0 → 1.15.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/node_stream_zip.d.ts +6 -0
- package/node_stream_zip.js +8 -4
- package/package.json +2 -2
package/node_stream_zip.d.ts
CHANGED
package/node_stream_zip.js
CHANGED
|
@@ -140,7 +140,8 @@ const StreamZip = function (config) {
|
|
|
140
140
|
const ready = false,
|
|
141
141
|
that = this,
|
|
142
142
|
entries = config.storeEntries !== false ? {} : null,
|
|
143
|
-
fileName = config.file
|
|
143
|
+
fileName = config.file,
|
|
144
|
+
textDecoder = config.nameEncoding ? new TextDecoder(config.nameEncoding) : null;
|
|
144
145
|
|
|
145
146
|
open();
|
|
146
147
|
|
|
@@ -343,7 +344,7 @@ const StreamZip = function (config) {
|
|
|
343
344
|
op.move = true;
|
|
344
345
|
return;
|
|
345
346
|
}
|
|
346
|
-
entry.read(buffer, bufferPos);
|
|
347
|
+
entry.read(buffer, bufferPos, textDecoder);
|
|
347
348
|
if (!config.skipEntryNameValidation) {
|
|
348
349
|
entry.validateName();
|
|
349
350
|
}
|
|
@@ -877,8 +878,11 @@ class ZipEntry {
|
|
|
877
878
|
this.extraLen = data.readUInt16LE(consts.LOCEXT);
|
|
878
879
|
}
|
|
879
880
|
|
|
880
|
-
read(data, offset) {
|
|
881
|
-
|
|
881
|
+
read(data, offset, textDecoder) {
|
|
882
|
+
const nameData = data.slice(offset, (offset += this.fnameLen));
|
|
883
|
+
this.name = textDecoder
|
|
884
|
+
? textDecoder.decode(new Uint8Array(nameData))
|
|
885
|
+
: nameData.toString('utf8');
|
|
882
886
|
const lastChar = data[offset - 1];
|
|
883
887
|
this.isDirectory = lastChar === 47 || lastChar === 92;
|
|
884
888
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-stream-zip",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "node.js library for reading and extraction of ZIP archives",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"zip",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"url": "https://github.com/antelle/node-stream-zip.git"
|
|
33
33
|
},
|
|
34
34
|
"engines": {
|
|
35
|
-
"node": ">=0.
|
|
35
|
+
"node": ">=0.12.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^14.14.6",
|