Headers Error in 7-zip #92
-
|
UPDATE: Looks like this problem exists only when unzipping with 7-zip - however the archive unzips fine and the files are also accessible. Hello! Thank you for this wonderful package! I've just run into a problem, hoping if I can get some help. I was trying to implement a solution to fetch files from API and add them to a zip (simply store - no compression). I am receiving a list of all files from an API - I'm then downloading the first file, adding it to zip, then downloading the next file, adding it to zip and so on... I was able to follow this: https://github.com/101arrowz/fflate/wiki/Guide:-Modern-(Buildless) I'm doing this: // callApi is my custom function using browser's fetch API that returns `response.blob()`
// files is the array of file list from API. It looks like [{path:'foo'},{path:'bar'}]
import {Zip, ZipPassThrough} from 'fflate'
downloadAll(index, zip, zipReadableStream) {
const fflToRS = fflateStream => new ReadableStream({
start(controller) {
fflateStream.ondata = (error, data, final) => {
if (error) {
controller.error(error)
} else {
controller.enqueue(data)
if (final) {
controller.close()
}
}
}
},
cancel() {
fflateStream.terminate()
}
})
const addFileToZip = async (fileData, fileObject, zip) => {
const zippedFileStream = new ZipPassThrough(fileObject.path)
zip.add(zippedFileStream)
const fileReader = fileData.stream().getReader()
while (true) {
const {done, value} = await fileReader.read()
if (done) {
zippedFileStream.push(new Uint8Array(0), true)
break
}
zippedFileStream.push(value)
}
}
zip = zip ? zip : new Zip()
zipReadableStream = zipReadableStream ? zipReadableStream : fflToRS(zip)
callApi('url', true).then(file => {
addFileToZip(file, files[index], zip).then(() => {
if (index++ < files.length - 1) {
downloadAll(index++, zip, zipReadableStream)
} else {
zip.end()
const zipResponse = new Response(zipReadableStream)
// rest
}
})
})
}I'm calling the function for the first time like Just wondering if there's any way to get rid of that error/warning. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
|
Does 7-zip provide any more details than "Headers Error"? Also, could you send a ZIP file that reproduces this? The fact it unzips properly despite the "error" indicates to me that there might be some kind of incompatibility. Whether or not it's something |
Beta Was this translation helpful? Give feedback.

Does 7-zip provide any more details than "Headers Error"? Also, could you send a ZIP file that reproduces this?
The fact it unzips properly despite the "error" indicates to me that there might be some kind of incompatibility. Whether or not it's something
fflatecan resolve I'd like to investigate. It seems similar to this comment.