Skip to content

Commit 19b8584

Browse files
authored
ZIP STORED method CRC32 and test
1 parent 50230e5 commit 19b8584

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

lib/archivers/zip/zip-archive-output-stream.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* https://github.com/archiverjs/node-compress-commons/blob/master/LICENSE-MIT
77
*/
88
var inherits = require('util').inherits;
9-
var crc32 = require('buffer-crc32');
9+
var crc32 = require('crc-32').buf;
1010
var {CRC32Stream} = require('crc32-stream');
1111
var {DeflateCRC32Stream} = require('crc32-stream');
1212

@@ -68,7 +68,7 @@ ZipArchiveOutputStream.prototype._appendBuffer = function(ae, source, callback)
6868
if (method === constants.METHOD_STORED) {
6969
ae.setSize(source.length);
7070
ae.setCompressedSize(source.length);
71-
ae.setCrc(crc32.unsigned(source));
71+
ae.setCrc(crc32(source)>>>0);
7272
}
7373

7474
this._writeLocalFileHeader(ae);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"test": "mocha --reporter dot"
2727
},
2828
"dependencies": {
29-
"buffer-crc32": "^0.2.13",
29+
"crc-32": "^1.2.0",
3030
"crc32-stream": "^4.0.2",
3131
"normalize-path": "^3.0.0",
3232
"readable-stream": "^3.6.0"

test/zip-archive-output-stream.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ describe('ZipArchiveOutputStream', function() {
8484
var entry2 = new ZipArchiveEntry('buffer.txt');
8585
var entry3 = new ZipArchiveEntry('stream.txt');
8686
var entry4 = new ZipArchiveEntry('stream-store.png');
87+
entry2.setMethod(0);
8788
entry4.setMethod(0);
8889

8990
testStream.on('close', function() {

0 commit comments

Comments
 (0)