question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extract a zip archive to buffer generates an invalid zip archive

See original GitHub issue

When open and extract a zip archive, it fails. Please use the following code and the attachment to reproduce it.

const AdmZip = require('adm-zip')

let zip1 = new AdmZip('./bug-data.zip')	//this zip file can be validated by other zip tools (7z, WinRAR), which should be valid.
//zip1.extractAllTo('./extracted1')		//this does succeed

//actually the following toBuffer() is buggy. It generates an entry with invalid CRC.
//If you write the buffer to a file and examine with zip tools (e.g. WinRAR), it says one entry is corrupted.
let zip2 = new AdmZip(zip1.toBuffer())	

//The following operation will fail: invalid block type
zip2.extractAllTo('./extracted2')

bug-data.zip

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
currancommented, Oct 24, 2019
0reactions
5saviahvcommented, Mar 9, 2021

It should be fixed for now

Read more comments on GitHub >

github_iconTop Results From Across the Web

5 Methods to Fix Zip File Is Valid Problem
Part 5: Run CMD to Repair/Restore Corrupted Or Invalid Zip Files ... The following method can also be used for erasing zip file...
Read more >
Can not open zip file after downloading through nodejs ...
Since a zip file is binary you should use a Buffer. Here is an example replacement for your utils.apiRequest with Buffer: utils.
Read more >
How to Fix & Recover Invalid Zip File [2022 Guide]
Option #1: To Unzip the File ... 1. Just open the WinZip & go to folder where your zipped files are located. 2....
Read more >
How To Work With Zip Files in Node.js - DigitalOcean
First, you'll combine multiple files into a ZIP archive using adm-zip . You'll then list the ZIP archive contents. After that, you'll add...
Read more >
zipfile — Work with ZIP archives — Python 3.11.1 documentation
Source code: Lib/zipfile.py The ZIP file format is a common archive and compression standard. This module provides tools to create, read, write, append, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found