Files
xrpl-hooks-ide/utils/zlib.ts
2022-08-17 11:50:49 +05:30

11 lines
365 B
TypeScript

export function isZlibData(data: Uint8Array): boolean {
// @ts-expect-error
const [firstByte, secondByte] = data
return firstByte === 0x78 && (secondByte === 0x01 || secondByte === 0x9c || secondByte === 0xda)
}
export async function decompressZlib(data: Uint8Array): Promise<Uint8Array> {
const { inflate } = await import('pako')
return inflate(data)
}