From b05c4e0bf8c8551598c0cff6ff85bcda9d6df531 Mon Sep 17 00:00:00 2001 From: Sead Feng Date: Tue, 27 Aug 2024 18:41:34 +0800 Subject: [PATCH] update --- src/components/frontend/page/home/results.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/frontend/page/home/results.tsx b/src/components/frontend/page/home/results.tsx index 3e33998..15fe3ab 100644 --- a/src/components/frontend/page/home/results.tsx +++ b/src/components/frontend/page/home/results.tsx @@ -23,9 +23,11 @@ const downloadImagesAsZip = (icons: { href: string, sizes?: string }[], domain: Promise.all([ import('jszip'), import('file-saver') - ]).then(([JSZip, FileSaver]) => { - const zip = new JSZip.default(); + ]).then(([JSZipModule, FileSaverModule]) => { + const JSZip = JSZipModule.default; + const zip = new JSZip(); const folder = zip.folder(`${domain}-images`); + const saveAs = FileSaverModule.saveAs; const addBase64Image = ({ base64Data, index, sizes }: { base64Data: string; index: number, sizes?: string; }) => { const data = base64Data.split(',')[1]; @@ -51,7 +53,7 @@ const downloadImagesAsZip = (icons: { href: string, sizes?: string }[], domain: Promise.all(imagePromises) .then(() => zip.generateAsync({ type: 'blob' })) - .then(content => FileSaver.saveAs(content, `${domain}-favicons.zip`)) + .then(content => saveAs(content, `${domain}-favicons.zip`)) .catch(error => { console.error('Error creating or saving zip:', error); });