jszip icon indicating copy to clipboard operation
jszip copied to clipboard

i want to save jszip in localStorage when browser refresh,but i don‘t know how to generateAsync localStorage jszip

Open extrastu opened this issue 3 years ago • 0 comments

import JSZip from 'jszip'
let zip = new JSZip()

const cache = JSON.parse(localStorage.getItem('zip'))
const email = localStorage.getItem('email')
if (cache) {
   const { files } = cache
   zip.files = files
   zip.generateAsync({ type: 'blob' }).then(function (blob) {
       saveAs(blob, `${email}.zip`)
    })

    localStorage.removeItem('zip')
    return
}

error

Uncaught (in promise) TypeError: t._compressWorker is not a function

What am I supposed to do?

extrastu avatar Nov 09 '22 01:11 extrastu