gzip-stream 2.0.2 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib.js +2 -22
  2. package/package.json +3 -3
package/lib.js CHANGED
@@ -66,7 +66,7 @@
66
66
  };
67
67
 
68
68
  exports.createGzipFromParts = function(parts) {
69
- var CRC32_PERIOD_NUMBER, i, isize, len, len1, normalizedParts, out, stream;
69
+ var i, isize, len, len1, out, stream;
70
70
  out = CombinedStream.create();
71
71
  // write the header
72
72
  out.append(GZIP_HEADER);
@@ -78,27 +78,7 @@
78
78
  // write ending DEFLATE part
79
79
  out.append(DEFLATE_END);
80
80
  // write CRC
81
- // 🤖-explanation: The CRC32 shift matrix M has period T = 2^32-1 (primitive polynomial),
82
- // so M^n = M^(n mod T). Reduce each part's len mod T before passing to
83
- // crc32_combine_multi, which accepts len as a 32-bit integer.
84
- // Special case: if n mod T = 0 (and n > 0), use T instead of 0 to avoid
85
- // the len=0 early-return in crc32_combine that would ignore crc2.
86
- CRC32_PERIOD_NUMBER = 0xffffffff;
87
- normalizedParts = parts.map(function(p) {
88
- var len;
89
- if (p.len <= CRC32_PERIOD_NUMBER) {
90
- return p;
91
- }
92
- len = p.len % CRC32_PERIOD_NUMBER;
93
- if (len === 0) {
94
- len = CRC32_PERIOD_NUMBER;
95
- }
96
- return {
97
- crc: p.crc,
98
- len: len
99
- };
100
- });
101
- out.append(crcUtils.crc32_combine_multi(normalizedParts).combinedCrc32);
81
+ out.append(crcUtils.crc32_combine_multi(parts).combinedCrc32);
102
82
  // write the ISIZE length, modulo 2^32 per RFC 1952 section 2.3.1
103
83
  // https://www.rfc-editor.org/info/rfc1952/#page-8:~:text=original%20(uncompressed)%20input-,data%20modulo%202%5E32
104
84
  len = Buffer.alloc(4);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gzip-stream",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "",
5
5
  "main": "lib.js",
6
6
  "scripts": {
@@ -24,7 +24,7 @@
24
24
  "author": "Balena Ltd. <hello@balena.io>",
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
- "@balena/node-crc-utils": "^3.0.0",
27
+ "@balena/node-crc-utils": "^3.1.0",
28
28
  "combined-stream": "^1.0.8",
29
29
  "crc32-stream": "^4.0.0"
30
30
  },
@@ -32,6 +32,6 @@
32
32
  "coffeescript": "^2.5.1"
33
33
  },
34
34
  "versionist": {
35
- "publishedAt": "2026-05-28T16:01:58.746Z"
35
+ "publishedAt": "2026-06-03T09:58:02.480Z"
36
36
  }
37
37
  }