diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml
index 6d5053fa..cff04237 100644
--- a/.github/workflows/nodejs.yml
+++ b/.github/workflows/nodejs.yml
@@ -28,3 +28,8 @@ jobs:
npm test
env:
CI: true
+ - name: Archive production artifacts
+ uses: actions/upload-artifact@v3
+ with:
+ name: tmp-zip
+ path: tmp/*.zip
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 50b0efdf..ccb7e020 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,7 @@
## Changelog
+**5.0.1** — _September 3, 2023_ — [Diff](https://github.com/archiverjs/node-compress-commons/compare/5.0.0...5.0.1)
+
**5.0.0** — _September 2, 2023_ — [Diff](https://github.com/archiverjs/node-compress-commons/compare/4.1.2...5.0.0)
diff --git a/lib/archivers/zip/zip-archive-output-stream.js b/lib/archivers/zip/zip-archive-output-stream.js
index 0b17dd49..9e04922b 100644
--- a/lib/archivers/zip/zip-archive-output-stream.js
+++ b/lib/archivers/zip/zip-archive-output-stream.js
@@ -6,7 +6,7 @@
* https://github.com/archiverjs/node-compress-commons/blob/master/LICENSE-MIT
*/
var inherits = require('util').inherits;
-var crc32 = require('buffer-crc32');
+var crc32 = require('crc-32');
var {CRC32Stream} = require('crc32-stream');
var {DeflateCRC32Stream} = require('crc32-stream');
@@ -68,7 +68,7 @@ ZipArchiveOutputStream.prototype._appendBuffer = function(ae, source, callback)
if (method === constants.METHOD_STORED) {
ae.setSize(source.length);
ae.setCompressedSize(source.length);
- ae.setCrc(crc32.unsigned(source));
+ ae.setCrc(crc32.buf(source) >>> 0);
}
this._writeLocalFileHeader(ae);
diff --git a/package-lock.json b/package-lock.json
index 9a7521ba..09fc267e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,15 +1,15 @@
{
"name": "compress-commons",
- "version": "4.1.2",
+ "version": "5.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "compress-commons",
- "version": "4.1.2",
+ "version": "5.0.0",
"license": "MIT",
"dependencies": {
- "buffer-crc32": "^0.2.13",
+ "crc-32": "^1.2.0",
"crc32-stream": "^5.0.0",
"normalize-path": "^3.0.0",
"readable-stream": "^3.6.0"
@@ -125,14 +125,6 @@
"integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",
"dev": true
},
- "node_modules/buffer-crc32": {
- "version": "0.2.13",
- "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
- "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=",
- "engines": {
- "node": "*"
- }
- },
"node_modules/camelcase": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz",
@@ -307,13 +299,9 @@
"dev": true
},
"node_modules/crc-32": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.0.tgz",
- "integrity": "sha512-1uBwHxF+Y/4yF5G48fwnKq6QsIXheor3ZLPT80yGBV1oEUwpPojlEhQbWKVw1VwcTQyMGHK1/XMmTjmlsmTTGA==",
- "dependencies": {
- "exit-on-epipe": "~1.0.1",
- "printj": "~1.1.0"
- },
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz",
+ "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",
"bin": {
"crc32": "bin/crc32.njs"
},
@@ -416,14 +404,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/exit-on-epipe": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/exit-on-epipe/-/exit-on-epipe-1.0.1.tgz",
- "integrity": "sha512-h2z5mrROTxce56S+pnvAV890uu7ls7f1kEvVGJbw1OlFH3/mlJ5bkXu0KRyW94v37zzHPiUd55iLn3DA7TjWpw==",
- "engines": {
- "node": ">=0.8"
- }
- },
"node_modules/fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
@@ -880,17 +860,6 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
- "node_modules/printj": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/printj/-/printj-1.1.2.tgz",
- "integrity": "sha512-zA2SmoLaxZyArQTOPj5LXecR+RagfPSU5Kw1qP+jkWeNlrq+eJZyY2oS68SU1Z/7/myXM4lo9716laOFAVStCQ==",
- "bin": {
- "printj": "bin/printj.njs"
- },
- "engines": {
- "node": ">=0.8"
- }
- },
"node_modules/randombytes": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
@@ -1301,11 +1270,6 @@
"integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",
"dev": true
},
- "buffer-crc32": {
- "version": "0.2.13",
- "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
- "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI="
- },
"camelcase": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz",
@@ -1437,13 +1401,9 @@
"dev": true
},
"crc-32": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.0.tgz",
- "integrity": "sha512-1uBwHxF+Y/4yF5G48fwnKq6QsIXheor3ZLPT80yGBV1oEUwpPojlEhQbWKVw1VwcTQyMGHK1/XMmTjmlsmTTGA==",
- "requires": {
- "exit-on-epipe": "~1.0.1",
- "printj": "~1.1.0"
- }
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz",
+ "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ=="
},
"crc32-stream": {
"version": "5.0.0",
@@ -1510,11 +1470,6 @@
"integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
"dev": true
},
- "exit-on-epipe": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/exit-on-epipe/-/exit-on-epipe-1.0.1.tgz",
- "integrity": "sha512-h2z5mrROTxce56S+pnvAV890uu7ls7f1kEvVGJbw1OlFH3/mlJ5bkXu0KRyW94v37zzHPiUd55iLn3DA7TjWpw=="
- },
"fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
@@ -1832,11 +1787,6 @@
"integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==",
"dev": true
},
- "printj": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/printj/-/printj-1.1.2.tgz",
- "integrity": "sha512-zA2SmoLaxZyArQTOPj5LXecR+RagfPSU5Kw1qP+jkWeNlrq+eJZyY2oS68SU1Z/7/myXM4lo9716laOFAVStCQ=="
- },
"randombytes": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
diff --git a/package.json b/package.json
index ac9b0b34..badd0009 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "compress-commons",
- "version": "5.0.0",
+ "version": "5.0.1",
"description": "a library that defines a common interface for working with archive formats within node",
"homepage": "https://github.com/archiverjs/node-compress-commons",
"author": {
@@ -26,7 +26,7 @@
"test": "mocha --reporter dot"
},
"dependencies": {
- "buffer-crc32": "^0.2.13",
+ "crc-32": "^1.2.0",
"crc32-stream": "^5.0.0",
"normalize-path": "^3.0.0",
"readable-stream": "^3.6.0"
diff --git a/test/zip-archive-output-stream.js b/test/zip-archive-output-stream.js
index b24ce556..ba2bbf7b 100644
--- a/test/zip-archive-output-stream.js
+++ b/test/zip-archive-output-stream.js
@@ -85,6 +85,8 @@ describe('ZipArchiveOutputStream', function() {
var entry3 = new ZipArchiveEntry('stream.txt');
var entry4 = new ZipArchiveEntry('stream-store.png');
entry4.setMethod(0);
+ var entry5 = new ZipArchiveEntry('buffer-store.txt')
+ entry5.setMethod(0)
testStream.on('close', function() {
done();
@@ -100,7 +102,10 @@ describe('ZipArchiveOutputStream', function() {
if (err) throw err;
archive.entry(entry4, fs.createReadStream('test/fixtures/image.png'), function(err) {
if (err) throw err;
- archive.finish();
+ archive.entry(entry5, testBuffer, function(err) {
+ if (err) throw err;
+ archive.finish();
+ });
});
});
});