Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Dec 11, 2024
1 parent ba54454 commit 72f2d5e
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/unzip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ async function unzip(inputData: Uint8Array) {
try {
let strm
let pos = 0
let i = 0
const chunks = []
let totalSize = 0
const blocks = [] as Uint8Array[]
let inflator
console.log('starting inputDatalen', inputData.length, inputData.byteLength)
do {
console.log(pos)
const remainingInput = inputData.subarray(pos)
inflator = new Inflate()
//@ts-ignore
Expand All @@ -34,18 +34,13 @@ async function unzip(inputData: Uint8Array) {
}

pos += strm.next_in
chunks[i] = inflator.result as Uint8Array
totalSize += chunks[i]!.length
i += 1
blocks.push(inflator.result as Uint8Array)
} while (strm.avail_in)

const result = new Uint8Array(totalSize)
for (let i = 0, offset = 0; i < chunks.length; i++) {
result.set(chunks[i]!, offset)
offset += chunks[i]!.length
}
return result
console.log('done', blocks)
return concatUint8Array(blocks)
} catch (e) {
console.error('WOWOWOWOW', e)
//cleanup error message
if (/incorrect header check/.exec(`${e}`)) {
throw new Error(
Expand Down

0 comments on commit 72f2d5e

Please sign in to comment.