node-unzipper icon indicating copy to clipboard operation
node-unzipper copied to clipboard

Unhandled rejection Error: invalid signature: 0x21726152

Open Joshuajrodrigues opened this issue 2 years ago • 5 comments

I have a zip file which gives this issue,thing is it opens just fine in 7 zip

Joshuajrodrigues avatar Jan 28 '23 17:01 Joshuajrodrigues

I belive its because its a 7 zip file https://stackoverflow.com/questions/4334199/unzipping-a-file-error

Any solution for this ?

Joshuajrodrigues avatar Jan 28 '23 18:01 Joshuajrodrigues

https://github.com/glebdmitriew/node-unzip-2/issues/1#issuecomment-167318268 I found another similar issue with a possible explanation. The zip file Im using was infact previously in another zip containing it

Joshuajrodrigues avatar Jan 28 '23 19:01 Joshuajrodrigues

Had the same issue, what worked for me was switching my code over to use one of the Open methods instead

lucasrmendonca avatar Feb 04 '24 20:02 lucasrmendonca

I'm just trying unzipped out and getting this error. My zips come from Macs and contain around 20 files and are about 20Mb in size. Tried two different zips with the same results using:

        const zip = fs.createReadStream(downloadedFilePath).pipe(unzipper.Parse({forceStream: true}));
        for await (const entry of zip) {
          const fileName = entry.path;
          console.debug(`File: ${fileName}`)
        }

Stack is:

/Users/clarkson/projects/mobile-automobile/functions/node_modules/unzipper/lib/parse.js:67
>        self.emit('error', new Error('invalid signature: 0x' + signature.toString(16)));
>                           ^
>  
>  Error: invalid signature: 0x4f44213c
>      at /Users/clarkson/projects/mobile-automobile/functions/node_modules/unzipper/lib/parse.js:67:26
>      at tryCatcher (/Users/clarkson/projects/mobile-automobile/functions/node_modules/unzipper/node_modules/bluebird/js/release/util.js:16:23)
>      at Promise._settlePromiseFromHandler (/Users/clarkson/projects/mobile-automobile/functions/node_modules/unzipper/node_modules/bluebird/js/release/promise.js:510:31)
>      at Promise._settlePromise (/Users/clarkson/projects/mobile-automobile/functions/node_modules/unzipper/node_modules/bluebird/js/release/promise.js:567:18)
>      at Promise._settlePromise0 (/Users/clarkson/projects/mobile-automobile/functions/node_modules/unzipper/node_modules/bluebird/js/release/promise.js:612:10)
>      at Promise._settlePromises (/Users/clarkson/projects/mobile-automobile/functions/node_modules/unzipper/node_modules/bluebird/js/release/promise.js:691:18)
>      at Async._drainQueue (/Users/clarkson/projects/mobile-automobile/functions/node_modules/unzipper/node_modules/bluebird/js/release/async.js:133:16)
>      at Async._drainQueues (/Users/clarkson/projects/mobile-automobile/functions/node_modules/unzipper/node_modules/bluebird/js/release/async.js:143:10)
>      at Async.drainQueues (/Users/clarkson/projects/mobile-automobile/functions/node_modules/unzipper/node_modules/bluebird/js/release/async.js:17:14)
>      at process.processImmediate (node:internal/timers:478:21)

drekka avatar May 15 '24 01:05 drekka

Now tried using Open like this

let zip = await unzipper.Open.file(downloadedFilePath)
zip.files.forEach( (file) => {
    console.debug(`[events_pubsub.ts] handleUploadScreenshotsEvent: Validating screenshot file ${file.path}`)
})

And it gives me a whole different error:

>  node:internal/process/promises:289
>              triggerUncaughtException(err, true /* fromPromise */);
>              ^
>  
>  Error: FILE_ENDED
>      at PullStream.pull (/Users/clarkson/projects/mobile-automobile/functions/node_modules/unzipper/lib/PullStream.js:78:28)
>      at PullStream.emit (node:events:518:28)
>      at PullStream.<anonymous> (/Users/clarkson/projects/mobile-automobile/functions/node_modules/unzipper/lib/PullStream.js:15:10)
>      at PullStream.emit (node:events:530:35)
>      at finish (node:internal/streams/writable:945:10)
>      at node:internal/streams/writable:926:13
>      at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

drekka avatar May 15 '24 02:05 drekka

Unzipper does not handle 7zip files, unless someone is willing to do the work and submit a PR.

ZJONSSON avatar Jun 08 '24 21:06 ZJONSSON