You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm using Pako to create zip files on image buffers as the following type: U8IntArray.
The problem occurs when I use Pako to push the data into the zip object, I check for the last item in my for loop, then I call the final push with data as my first arg and true as my second arg.
// "files" is an array of data, split in pieces... An array of buffers.
// Example:
// ArrayOfManyFiles = [MoreFiles,MoreFiles, ... etc. ]
// MoreFiles = [ {key: string, value: Buffer}, {key: string, value: Buffer} ... ]
//
return new Promise(async (res, rej) => {
let zp = new pako.Deflate()
let final = false;
for await (let file of files) {
let len = file.length
for (let index = 0; index < file.length; index++) {
const ff = file[index];
log.info(`Zipping ${ff.key}`)
let data = (ff.value as any).data as Buffer
const fileBuffer = new Uint8Array(data);
if (index == len - 1) {
final = true;
}
zp.push(fileBuffer, final)
if (zp.err > 0) {
rej("ERROR: " + Error("invalid file! " + ff.key))
}
}
}
let result = zp.result
res(result)
})
Please help.
The text was updated successfully, but these errors were encountered:
Hello, I'm using Pako to create zip files on image buffers as the following type: U8IntArray.
The problem occurs when I use Pako to push the data into the zip object, I check for the last item in my for loop, then I call the final
push
with data as my first arg and true as my second arg.Please help.
The text was updated successfully, but these errors were encountered: