cthackers / adm-zip

A Javascript implementation of zip for nodejs. Allows user to create or extract zip files both in memory or to/from disk
MIT License
2.06k stars 375 forks source link

`extractEntryTo` not preserving subdirectories as of 0.4.11 #306

Open keattang opened 4 years ago

keattang commented 4 years ago

Hi,

I recently upgraded from 0.4.10 to the latest (0.4.14) and found that extractEntryTo was no longer preserving subdirectories in my zip files. Instead it was unzipping everything into a flat folder.

To demonstrate this issue you can download any Github repository zip such as: https://github.com/cthackers/adm-zip/archive/master.zip

These zip files contain a single top level entry which is a folder that contains the code. I want to unzip the contents of that folder into another folder. To do so I am doing this:

const AdmZip = require("adm-zip");

const zip = new AdmZip("/path/to/my/file.zip");

zip.extractEntryTo(zip.getEntries()[0], "myNewDirectory", false, true);

I expect myNewDirectory to hold the Github Repo code just as it looks in GitHub, but instead it contains no folders and every file is sitting flat inside myNewDirectory. This worked in 0.4.10 however when I tried rolling back versions I found it was broken in every version after 0.4.10.

Thanks for taking a look at this issue. Let me know if you need any more details.

Scui1 commented 3 years ago

I noticed the same, any update on this?