adm-zip icon indicating copy to clipboard operation
adm-zip copied to clipboard

`extractAllTo` does not overwrite/replace existed folder when parameter is set to `true` or `false`.

Open percenuage opened this issue 3 years ago • 1 comments

Hello,

The method extractAllTo does not work as expected and the documentation is not up to date (version 0.5.9)

This is my code:

const zipFile = new Zip('yolo.zip', {});
zipFile.extractAllTo('.', true, false, null);

Thx for your help :)

percenuage avatar Oct 17 '21 17:10 percenuage

@percenuage I am facing the same issue. Did you find any solution? Or anyone can help with this?

jaythakor-ai avatar Jan 16 '23 13:01 jaythakor-ai

yes if folder is already existing we use it and only if folder does not exist new folder is created.

Deleting old folders with ADM-ZIP is not good idea: Lets say you have half the files in one file and others in other file. So each time you try extract one of them previously extracted files are deleted with directories. I must say it may satisfy less than 1 % of the cases.

If empty folders are really needed. You should use package like rimraf for making sure folders are empty. So they can be re- created.

5saviahv avatar May 22 '24 18:05 5saviahv