mockingbot / react-native-zip-archive

Zip archive utility for react-native
MIT License
420 stars 154 forks source link

Error: Failed to extract file invalid END header #290

Open oiver555 opened 12 months ago

oiver555 commented 12 months ago

Describe the bug When I unzip my .zip file I get this error, Error: Failed to extract file invalid END header (bad central directory offset) Error: Failed to extract file invalid END header (bad central directory offset). The zip file is not corrupt because I am able to download that file from my firebase account and unzip that very .zip file locally using my computer.

Here is the basic Code

        await utilities.makeDocDir(`${settingsState.currTranslation}/images`)
        await utilities.downloadDocURI(coversURI, `${settingsState.currTranslation}/covers.zip`)

        const targetPath = FileSystem.documentDirectory + `${settingsState.currTranslation}/images`
        const sourcePath = FileSystem.documentDirectory + `${settingsState.currTranslation}/covers.zip`

        const unzipRes = await unzip(sourcePath, targetPath, 'UTF-8') <-- Error Occurs Here`

Expected behavior To unzip the .zip file like usual

Reproduction I put together this Expo Snack to show the issue, but for some reason the unzip function is not working, https://snack.expo.dev/@oiver55/8e424e

Env (please complete the following information):

Additional context Here is a link (https://firebasestorage.googleapis.com/v0/b/vthwritings.appspot.com/o/english%2Fzip%2Fcovers.zip?alt=media&token=1a388104-6499-4eb4-8044-08d1c55755e5) to the zip file in question. Please let me know if you too have the same error if you decide to give it a shot.

oiver555 commented 11 months ago

Please if there is more information you need from me to answer or help just let me know. I don't understand why the unzip function is working in my app from google play store, however when I make a eas debug build of it, it doesn't work.