From 154fb2d723629984021b102c8ac419ef6ce007bc Mon Sep 17 00:00:00 2001 From: ArtemHoruzhenko Date: Wed, 11 Dec 2024 16:56:56 +0200 Subject: [PATCH] gunzip using pako --- package.json | 4 +-- .../src/utils/decompressors/decompressors.ts | 5 ++-- .../tests/decompressors/decompressors.spec.ts | 2 +- yarn.lock | 25 ------------------- 4 files changed, 4 insertions(+), 32 deletions(-) diff --git a/package.json b/package.json index 0ce9d54f7d..16b8bff3d3 100644 --- a/package.json +++ b/package.json @@ -110,7 +110,6 @@ "@types/electron-store": "^3.2.0", "@types/express": "^4.17.3", "@types/file-saver": "^2.0.5", - "@types/gzip-js": "^0.3.3", "@types/html-entities": "^1.3.4", "@types/ioredis": "^4.26.0", "@types/is-glob": "^4.0.2", @@ -239,7 +238,6 @@ "formik": "^2.2.9", "fzstd": "^0.1.0", "get-port": "^7.0.0", - "gzip-js": "^0.3.2", "html-entities": "^2.3.2", "html-react-parser": "^1.2.4", "java-object-serialization": "^0.1.2", @@ -289,4 +287,4 @@ "browser": { "uuid": "./node_modules/uuid/dist/esm-browser/index.js" } -} \ No newline at end of file +} diff --git a/redisinsight/ui/src/utils/decompressors/decompressors.ts b/redisinsight/ui/src/utils/decompressors/decompressors.ts index 2e10502ddf..14f85cf591 100644 --- a/redisinsight/ui/src/utils/decompressors/decompressors.ts +++ b/redisinsight/ui/src/utils/decompressors/decompressors.ts @@ -1,12 +1,11 @@ import { forIn } from 'lodash' -import { unzip } from 'gzip-js' import { decompress as decompressFzstd } from 'fzstd' // @ts-ignore import { decompress as decompressLz4 } from 'lz4js' import { decompress as decompressSnappy } from '@stablelib/snappy' // @ts-ignore import { decompress as decompressBrotli } from 'brotli-unicode/js' -import { inflate } from 'pako' +import { inflate, ungzip } from 'pako' import { COMPRESSOR_MAGIC_SYMBOLS, ICompressorMagicSymbols, KeyValueCompressor } from 'uiSrc/constants' import { RedisResponseBuffer, RedisString } from 'uiSrc/slices/interfaces' import { anyToBuffer, bufferToString, bufferToUint8Array, isEqualBuffers, Nullable } from 'uiSrc/utils' @@ -24,7 +23,7 @@ const decompressingBuffer = ( try { switch (compressor) { case KeyValueCompressor.GZIP: { - const value = unzip(Buffer.from(reply)) + const value = ungzip(Buffer.from(reply)) return { compressor, diff --git a/redisinsight/ui/src/utils/tests/decompressors/decompressors.spec.ts b/redisinsight/ui/src/utils/tests/decompressors/decompressors.spec.ts index 9dab8e8716..41756512d3 100644 --- a/redisinsight/ui/src/utils/tests/decompressors/decompressors.spec.ts +++ b/redisinsight/ui/src/utils/tests/decompressors/decompressors.spec.ts @@ -174,7 +174,7 @@ describe('decompressingBuffer', () => { const result = decompressingBuffer(input, compressorInit || compressor) let value: UintArray = output - if (compressor && compressor !== KeyValueCompressor.GZIP) { + if (compressor) { value = new Uint8Array(output) } diff --git a/yarn.lock b/yarn.lock index 4cbe9cb2ab..0b2682ffca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2682,13 +2682,6 @@ dependencies: "@types/node" "*" -"@types/gzip-js@^0.3.3": - version "0.3.3" - resolved "https://registry.yarnpkg.com/@types/gzip-js/-/gzip-js-0.3.3.tgz#b485ce6f007c57fbac9ea7256c30f437ceb5fa1a" - integrity sha512-Bp4dv9hfpD49sjn59+8VPMDm4O5Lx1qSLKn4GqV9ENbvoKrCV7GntIr7e85cFjtRWRPTXkIxWTCk4DKMXostMg== - dependencies: - "@types/node" "*" - "@types/hast@^2.0.0": version "2.3.4" resolved "https://registry.yarnpkg.com/@types/hast/-/hast-2.3.4.tgz#8aa5ef92c117d20d974a82bdfb6a648b08c0bafc" @@ -4794,11 +4787,6 @@ cosmiconfig@^8.1.3: parse-json "^5.2.0" path-type "^4.0.0" -"crc32@>= 0.2.2": - version "0.2.2" - resolved "https://registry.yarnpkg.com/crc32/-/crc32-0.2.2.tgz#7ad220d6ffdcd119f9fc127a7772cacea390a4ba" - integrity sha512-PFZEGbDUeoNbL2GHIEpJRQGheXReDody/9axKTxhXtQqIL443wnNigtVZO9iuCIMPApKZRv7k2xr8euXHqNxQQ== - crc@^3.8.0: version "3.8.0" resolved "https://registry.yarnpkg.com/crc/-/crc-3.8.0.tgz#ad60269c2c856f8c299e2c4cc0de4556914056c6" @@ -5452,11 +5440,6 @@ define-properties@^1.1.3, define-properties@^1.1.4, define-properties@^1.2.0, de has-property-descriptors "^1.0.0" object-keys "^1.1.1" -"deflate-js@>= 0.2.2": - version "0.2.3" - resolved "https://registry.yarnpkg.com/deflate-js/-/deflate-js-0.2.3.tgz#f85abb58ebc5151a306147473d57c3e4f7e4426b" - integrity sha512-r5KgHJ/yTiWQs23nVeQz5dSL/kmW0MBszsssNyEqDCjjFDj4XG/c6QUN/I0JtY3ZHwwcaNBtGE8s+oV33acTfQ== - delaunator@5: version "5.0.0" resolved "https://registry.yarnpkg.com/delaunator/-/delaunator-5.0.0.tgz#60f052b28bd91c9b4566850ebf7756efe821d81b" @@ -7186,14 +7169,6 @@ gunzip-maybe@^1.4.2: pumpify "^1.3.3" through2 "^2.0.3" -gzip-js@^0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/gzip-js/-/gzip-js-0.3.2.tgz#23117efeeb28cf385248deff0dffad894836d96b" - integrity sha512-BFTiwtEN12koJsnhVo77SzW+u6VANzhaK0HEtdwFwgFzFOq1WQJ8eSPEyGAueUfs1C/WqdgtuYnUwCRuRm1A5Q== - dependencies: - crc32 ">= 0.2.2" - deflate-js ">= 0.2.2" - gzip-size@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-6.0.0.tgz#065367fd50c239c0671cbcbad5be3e2eeb10e462"