node-stream-zip
Advanced tools
Comparing version 1.14.0 to 1.15.0
@@ -36,2 +36,8 @@ /// <reference types="node" /> | ||
chunkSize?: number; | ||
/** | ||
* Encoding used to decode file names | ||
* @default UTF8 | ||
*/ | ||
nameEncoding?: string; | ||
} | ||
@@ -38,0 +44,0 @@ |
@@ -143,3 +143,4 @@ /** | ||
entries = config.storeEntries !== false ? {} : null, | ||
fileName = config.file; | ||
fileName = config.file, | ||
textDecoder = config.nameEncoding ? new TextDecoder(config.nameEncoding) : null; | ||
@@ -347,3 +348,3 @@ open(); | ||
} | ||
entry.read(buffer, bufferPos); | ||
entry.read(buffer, bufferPos, textDecoder); | ||
if (!config.skipEntryNameValidation) { | ||
@@ -882,4 +883,7 @@ entry.validateName(); | ||
read(data, offset) { | ||
this.name = data.slice(offset, (offset += this.fnameLen)).toString(); | ||
read(data, offset, textDecoder) { | ||
const nameData = data.slice(offset, (offset += this.fnameLen)); | ||
this.name = textDecoder | ||
? textDecoder.decode(new Uint8Array(nameData)) | ||
: nameData.toString('utf8'); | ||
const lastChar = data[offset - 1]; | ||
@@ -886,0 +890,0 @@ this.isDirectory = lastChar === 47 || lastChar === 92; |
{ | ||
"name": "node-stream-zip", | ||
"version": "1.14.0", | ||
"version": "1.15.0", | ||
"description": "node.js library for reading and extraction of ZIP archives", | ||
@@ -35,3 +35,3 @@ "keywords": [ | ||
"engines": { | ||
"node": ">=0.10.0" | ||
"node": ">=0.12.0" | ||
}, | ||
@@ -38,0 +38,0 @@ "devDependencies": { |
53714
1276