我使用以下代码下载 zip 文件。 下载了 zip 文件,但会导致应用程序无法控制地重新呈现。 谁能帮我解决这个问题。
let zipFilename = "Douments.zip";
downloadUrls.forEach((url, index) => {
// loading a file and add it in a zip file
JSZipUtils.getBinaryContent(url.url, (err, data) => {
if (err) {
throw err; // or handle the error
}
let date = new Date()
zip.file(url.fileName, data, { binary: true });
count++;
if (count === downloadUrls.length) {
zip.generateAsync({ type: 'blob' }).then((content) => {
FileSaver.saveAs(content, zipFilename);
console.log("trigger", content)
});
}
});
})```