Comparing version 2.2.0 to 2.2.1
18
index.js
@@ -67,2 +67,3 @@ var fs = require("fs"); | ||
entry.crc32 = crc32.unsigned(buffer); | ||
entry.crcAndFileSizeKnown = true; | ||
self.entries.push(entry); | ||
@@ -207,4 +208,4 @@ if (!entry.compress) { | ||
entry.uncompressedSize + | ||
FILE_DESCRIPTOR_SIZE + | ||
CENTRAL_DIRECTORY_RECORD_FIXED_SIZE + entry.utf8FileName.length; | ||
if (!entry.crcAndFileSizeKnown) result += FILE_DESCRIPTOR_SIZE; | ||
} | ||
@@ -258,2 +259,3 @@ result += END_OF_CENTRAL_DIRECTORY_RECORD_SIZE; | ||
if (isDirectory) { | ||
this.crcAndFileSizeKnown = true; | ||
this.crc32 = 0; | ||
@@ -263,3 +265,4 @@ this.uncompressedSize = 0; | ||
} else { | ||
// unknown | ||
// unknown so far | ||
this.crcAndFileSizeKnown = false; | ||
this.crc32 = null; | ||
@@ -304,9 +307,6 @@ this.uncompressedSize = null; | ||
Entry.prototype.getLocalFileHeader = function() { | ||
var crcAndFileSizeKnown = this.crc32 != null && | ||
this.uncompressedSize != null && | ||
this.compressedSize != null; | ||
var crc32 = 0; | ||
var compressedSize = 0; | ||
var uncompressedSize = 0; | ||
if (crcAndFileSizeKnown) { | ||
if (this.crcAndFileSizeKnown) { | ||
crc32 = this.crc32; | ||
@@ -319,3 +319,3 @@ compressedSize = this.compressedSize; | ||
var generalPurposeBitFlag = FILE_NAME_IS_UTF8; | ||
if (!crcAndFileSizeKnown) generalPurposeBitFlag |= UNKNOWN_CRC32_AND_FILE_SIZES; | ||
if (!this.crcAndFileSizeKnown) generalPurposeBitFlag |= UNKNOWN_CRC32_AND_FILE_SIZES; | ||
@@ -341,2 +341,6 @@ fixedSizeStuff.writeUInt32LE(0x04034b50, 0); // local file header signature 4 bytes (0x04034b50) | ||
Entry.prototype.getFileDescriptor = function() { | ||
if (this.crcAndFileSizeKnown) { | ||
// MAC's Archive Utility requires this not be present unless we set general purpose bit 3 | ||
return new Buffer(0); | ||
} | ||
var buffer = new Buffer(FILE_DESCRIPTOR_SIZE); | ||
@@ -343,0 +347,0 @@ buffer.writeUInt32LE(0x08074b50, 0); // optional signature (required according to Archive Utility) |
{ | ||
"name": "yazl", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "yet another zip library for node", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -230,3 +230,3 @@ # yazl | ||
it is impossible to know the crc32 before processing the file data. | ||
File Descriptors are given after each file data with this information, as per the spec. | ||
When bit `3` is set, file Descriptors are given after each file data with this information, as per the spec. | ||
But remember a complete metadata listing is still always available in the central directory record, | ||
@@ -238,5 +238,5 @@ so if unzip implementations are relying on that, like they should, | ||
so yazl includes the optional file descriptor signature. | ||
Additionally, 7-Zip 9.20 does not seem to support general purpose bit `3` at all | ||
(it declares it an unsupported compression method, which is just wrong. | ||
See [issue #11](https://github.com/thejoshwolfe/yazl/issues/11)). | ||
When bit `3` is not used, Mac's Archive Utility requires there to be no file descriptor, so yazl skips it in that case. | ||
Additionally, 7-Zip 9.20 does not seem to support bit `3` at all | ||
(see [issue #11](https://github.com/thejoshwolfe/yazl/issues/11)). | ||
@@ -243,0 +243,0 @@ All other bits are unset. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31127
390