Open haoma2514 opened 8 months ago
The zip file saved by firefox is incomplete. The following are files saved by Firefox: The file saved by chrome is correct.
this's my code:
export const downloadFileByFetchToZip = (fileName:string,files:downloadAnnexModel[])=>{ streamSaver.mitm= '/shtml/mitm.html' const zipFileOutputStream = streamSaver.createWriteStream(fileName+".zip"); const fileIterator = files.values(); const readableZipStream = new Zip({ async pull(ctrl) { const fileInfo = fileIterator.next(); if (fileInfo.done) { ctrl.close(); } else { const {fileName, fileUrl} = fileInfo.value; return fetch(fileUrl).then(res => { ctrl.enqueue({ fileName, stream: () => res.body }); }).catch((x)=>console.error("error",x)) } //ctrl.close() } }); if (window.WritableStream && readableZipStream.pipeTo) { readableZipStream .pipeTo(zipFileOutputStream) .then(() => console.log("done")).catch((error)=>{ console.log("error",error) }) } }
After the file is saved, the then block is not executed, and the catch block is not executed. It is not clear which link has gone wrong.
The zip file saved by firefox is incomplete. The following are files saved by Firefox:
The file saved by chrome is correct.
![图片](https://github.com/jimmywarting/StreamSaver.js/assets/37583057/b66a430f-a7f8-4ff6-ab33-17135771a9d3)
this's my code:
After the file is saved, the then block is not executed, and the catch block is not executed. It is not clear which link has gone wrong.