Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
seadfeng committed Aug 27, 2024
1 parent bc89e56 commit b05c4e0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/frontend/page/home/results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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);
});
Expand Down

0 comments on commit b05c4e0

Please # to comment.