node-stream-zip
Advanced tools
Comparing version 1.11.7 to 1.12.0
@@ -7,6 +7,13 @@ /// <reference types="node" /> | ||
* File to read | ||
* @default undefined | ||
*/ | ||
file: string | ||
file?: string | ||
/** | ||
* Alternatively, you can pass fd here | ||
* @default undefined | ||
*/ | ||
fd?: number, | ||
/** | ||
* You will be able to work with entries inside zip archive, | ||
@@ -13,0 +20,0 @@ * otherwise the only way to access them is entry event |
@@ -166,14 +166,23 @@ /** | ||
function open() { | ||
fs.open(fileName, 'r', function(err, f) { | ||
if (err) | ||
return that.emit('error', err); | ||
fd = f; | ||
fs.fstat(fd, function(err, stat) { | ||
if (config.fd) { | ||
fd = config.fd; | ||
readFile(); | ||
} else { | ||
fs.open(fileName, 'r', function (err, f) { | ||
if (err) | ||
return that.emit('error', err); | ||
fileSize = stat.size; | ||
chunkSize = config.chunkSize || Math.round(fileSize / 1000); | ||
chunkSize = Math.max(Math.min(chunkSize, Math.min(128*1024, fileSize)), Math.min(1024, fileSize)); | ||
readCentralDirectory(); | ||
fd = f; | ||
readFile(); | ||
}); | ||
} | ||
} | ||
function readFile() { | ||
fs.fstat(fd, function(err, stat) { | ||
if (err) | ||
return that.emit('error', err); | ||
fileSize = stat.size; | ||
chunkSize = config.chunkSize || Math.round(fileSize / 1000); | ||
chunkSize = Math.max(Math.min(chunkSize, Math.min(128*1024, fileSize)), Math.min(1024, fileSize)); | ||
readCentralDirectory(); | ||
}); | ||
@@ -180,0 +189,0 @@ } |
{ | ||
"name": "node-stream-zip", | ||
"version": "1.11.7", | ||
"version": "1.12.0", | ||
"description": "node.js library for reading and extraction of ZIP archives", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
47051
1077