b4n1-boost 0.4.1 → 0.4.2
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.
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/core.test.js
CHANGED
|
@@ -244,10 +244,16 @@ test('gzip: round-trip compresses and decompresses', () => {
|
|
|
244
244
|
assert.strictEqual(decompressed.toString(), data.toString());
|
|
245
245
|
});
|
|
246
246
|
|
|
247
|
-
test('gzip: empty buffer
|
|
248
|
-
//
|
|
249
|
-
//
|
|
250
|
-
|
|
247
|
+
test('gzip: empty buffer compresses to a valid empty stream', () => {
|
|
248
|
+
// An empty payload is a LEGITIMATE input (HTTP 204 bodies, empty files),
|
|
249
|
+
// and several runtimes hand over a NULL data pointer for it (Node's
|
|
250
|
+
// Buffer.alloc(0)). The core used to reject it as a documented
|
|
251
|
+
// limitation; that was a landmine in every SDK, so the core now
|
|
252
|
+
// compresses it like any other payload (2026-10-21, task d2a8c072).
|
|
253
|
+
const compressed = Boost.compressGzip(Buffer.from(''), 4);
|
|
254
|
+
assert.ok(compressed.length > 0, 'an empty payload still yields a gzip stream');
|
|
255
|
+
const zlib = require('zlib');
|
|
256
|
+
assert.strictEqual(zlib.gunzipSync(compressed).length, 0);
|
|
251
257
|
});
|
|
252
258
|
|
|
253
259
|
test('gzip: large payload', () => {
|
|
@@ -283,8 +289,12 @@ test('zstd: actually compresses (not a passthrough)', () => {
|
|
|
283
289
|
assert.ok(compressed.length < 100, `expected < 100 bytes, got ${compressed.length}`);
|
|
284
290
|
});
|
|
285
291
|
|
|
286
|
-
test('zstd: empty input
|
|
287
|
-
|
|
292
|
+
test('zstd: empty input compresses to a valid empty stream', () => {
|
|
293
|
+
// Same contract as gzip: an empty payload is valid input, not an error
|
|
294
|
+
// (the core used to reject it — task d2a8c072).
|
|
295
|
+
const compressed = Boost.compressZstd(Buffer.from(''), 3);
|
|
296
|
+
assert.ok(compressed.length > 0);
|
|
297
|
+
assert.strictEqual(Boost.decompressZstd(compressed).length, 0);
|
|
288
298
|
});
|
|
289
299
|
|
|
290
300
|
test('zstd: different levels', () => {
|