mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-12-11 18:26:04 +00:00
Initial commit
This commit is contained in:
14
assets/js/hooks/Mapper/utils/decompressToJson.ts
Normal file
14
assets/js/hooks/Mapper/utils/decompressToJson.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import pako from 'pako';
|
||||
|
||||
export const decompressToJson = (base64string: string) => {
|
||||
const base64_decoded = atob(base64string);
|
||||
const charData = base64_decoded.split('').map(function (x) {
|
||||
return x.charCodeAt(0);
|
||||
});
|
||||
const zlibData = new Uint8Array(charData);
|
||||
const inflatedData = pako.inflate(zlibData, {
|
||||
to: 'string',
|
||||
});
|
||||
|
||||
return JSON.parse(inflatedData);
|
||||
};
|
||||
Reference in New Issue
Block a user