Comparing version 2.1.3 to 2.2.0
27
index.js
@@ -260,3 +260,6 @@ var fs = require("fs"); | ||
} else { | ||
this.uncompressedSize = null; // unknown | ||
// unknown | ||
this.crc32 = null; | ||
this.uncompressedSize = null; | ||
this.compressedSize = null; | ||
if (options.size != null) this.uncompressedSize = options.size; | ||
@@ -298,4 +301,18 @@ } | ||
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) { | ||
crc32 = this.crc32; | ||
compressedSize = this.compressedSize; | ||
uncompressedSize = this.uncompressedSize; | ||
} | ||
var fixedSizeStuff = new Buffer(LOCAL_FILE_HEADER_FIXED_SIZE); | ||
var generalPurposeBitFlag = UNKNOWN_CRC32_AND_FILE_SIZES | FILE_NAME_IS_UTF8; | ||
var generalPurposeBitFlag = FILE_NAME_IS_UTF8; | ||
if (!crcAndFileSizeKnown) generalPurposeBitFlag |= UNKNOWN_CRC32_AND_FILE_SIZES; | ||
fixedSizeStuff.writeUInt32LE(0x04034b50, 0); // local file header signature 4 bytes (0x04034b50) | ||
@@ -307,5 +324,5 @@ fixedSizeStuff.writeUInt16LE(VERSION_NEEDED_TO_EXTRACT, 4); // version needed to extract 2 bytes | ||
fixedSizeStuff.writeUInt16LE(this.lastModFileDate, 12); // last mod file date 2 bytes | ||
fixedSizeStuff.writeUInt32LE(0, 14); // crc-32 4 bytes | ||
fixedSizeStuff.writeUInt32LE(0, 18); // compressed size 4 bytes | ||
fixedSizeStuff.writeUInt32LE(0, 22); // uncompressed size 4 bytes | ||
fixedSizeStuff.writeUInt32LE(crc32, 14); // crc-32 4 bytes | ||
fixedSizeStuff.writeUInt32LE(compressedSize, 18); // compressed size 4 bytes | ||
fixedSizeStuff.writeUInt32LE(uncompressedSize, 22); // uncompressed size 4 bytes | ||
fixedSizeStuff.writeUInt16LE(this.utf8FileName.length, 26); // file name length 2 bytes | ||
@@ -312,0 +329,0 @@ fixedSizeStuff.writeUInt16LE(0, 28); // extra field length 2 bytes |
{ | ||
"name": "yazl", | ||
"version": "2.1.3", | ||
"version": "2.2.0", | ||
"description": "yet another zip library for node", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -122,2 +122,11 @@ # yazl | ||
This method has the unique property that General Purpose Bit `3` will not be used in the Local File Header. | ||
This doesn't matter for unzip implementations that conform to the Zip File Spec. | ||
However, 7-Zip 9.20 has a known bug where General Purpose Bit `3` is declared an unsupported compression method | ||
(note that it really has nothing to do with the compression method.). | ||
See [issue #11](https://github.com/thejoshwolfe/yazl/issues/11). | ||
If you would like to create zip files that 7-Zip 9.20 can understand, | ||
you must use `addBuffer()` instead of `addFile()` or `addReadStream()` for all entries in the zip file | ||
(and `addEmptyDirectory()` is fine too). | ||
#### addEmptyDirectory(metadataPath, [options]) | ||
@@ -219,3 +228,3 @@ | ||
Bit `3` is set in the Local File Header. | ||
Bit `3` is usually set in the Local File Header. | ||
To support both a streaming input and streaming output api, | ||
@@ -227,4 +236,8 @@ it is impossible to know the crc32 before processing the file data. | ||
none of this paragraph will matter anyway. | ||
Even so, Mac's Archive Utility requires File Descriptors to include the optional signature, | ||
Even so, some popular unzip implementations do not follow the spec. | ||
Mac's Archive Utility requires File Descriptors to include the optional signature, | ||
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)). | ||
@@ -261,2 +274,4 @@ All other bits are unset. | ||
* 2.2.0 | ||
* Avoid using general purpose bit 3 for `addBuffer()` calls. [issue #13](https://github.com/thejoshwolfe/yazl/issues/13) | ||
* 2.1.3 | ||
@@ -263,0 +278,0 @@ * Fix bug when only addBuffer() and end() are called. [issue #12](https://github.com/thejoshwolfe/yazl/issues/12) |
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
30924
386
284