Skip to content

Commit f78e03a

Browse files
Merge pull request #135 from ISISComputingGroup/remove_pako
remove pako - can just zlib module instead
2 parents ca33294 + 13e1af6 commit f78e03a

File tree

3 files changed

+2
-34
lines changed

3 files changed

+2
-34
lines changed

app/components/dehex_and_decompress.ts

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,13 @@
1-
import pako from "pako";
21
import { instList } from "@/app/types";
3-
4-
function unhexlify(str: string): string {
5-
let result = "";
6-
for (let i = 0, l = str.length; i < l; i += 2) {
7-
result += String.fromCharCode(parseInt(str.slice(i, i + 2), 16));
8-
}
9-
return result;
10-
}
11-
2+
import { unzipSync } from "zlib";
123
/**
134
* dehex_and_decompress
145
* - synonymous to dehex_and_decompress in inst_servers
156
* @param {*} input raw data
167
* @returns dehexed and decompressed data (you can choose to JSON parse it or not afterwards)
178
*/
189
export function dehex_and_decompress(input: string): string {
19-
// DEHEX
20-
const unhexed = unhexlify(input);
21-
const charData = unhexed.split("").map(function (x) {
22-
return x.charCodeAt(0);
23-
});
24-
// convert to binary
25-
const binData = new Uint8Array(charData);
26-
return pako.inflate(binData, { to: "string" });
10+
return unzipSync(Buffer.from(input, "hex")).toString();
2711
}
2812

2913
/**

package-lock.json

Lines changed: 0 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@
1313
"format_check": "prettier --check \"**/*.{ts,tsx,md,js,json,yml,yaml}\""
1414
},
1515
"dependencies": {
16-
"@types/pako": "^2.0.3",
1716
"cross-env": "^7.0.3",
1817
"next": "^15.2.4",
19-
"pako": "^2.1.0",
2018
"react": "^19.0.0",
2119
"react-dom": "^19.0.0",
2220
"react-use-websocket": "^4.8.1"

0 commit comments

Comments
 (0)