You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importAdmZipfrom"adm-zip";letzip=newAdmZip("./test.zip");console.log("* Before delete of test/path1/:");zip.getEntries().forEach((entry)=>{console.log(entry.entryName);});zip.deleteFile("test/path1/");console.log("");console.log("* After delete of test/path1/:");zip.getEntries().forEach((entry)=>{console.log(entry.entryName);});
The result will be
* Before delete of test/path1/:
test/
test/path2/
test/path2/file1.txt
test/path2/folder1/
test/path2/folder1/file2.txt
test/path1/
test/path1/file1.txt
test/path1/folder1/
test/path1/folder1/file2.txt
* After delete of test/path1/:
test/
test/path2/
test/path2/file1.txt
test/path2/folder1/
As it can be seen during the deletion of /test/path1/ also /test/path2/folder1/file2.txt has been eliminated.
I have not debugged it to much, but from a first look to me it is that in the deleteFile function, in particular when eliminating the entry from the entryList here, the entry is not found and thus indexOf will return -1 that causes the elimination of the last element of the array.
The text was updated successfully, but these errors were encountered:
To reporduce the issue create a folder with the following form
create a zip, for example on linux terminal with
zip -r test.zip test
Now run the following code
The result will be
As it can be seen during the deletion of
/test/path1/
also/test/path2/folder1/file2.txt
has been eliminated.I have not debugged it to much, but from a first look to me it is that in the deleteFile function, in particular when eliminating the entry from the entryList here, the entry is not found and thus
indexOf
will return-1
that causes the elimination of the last element of the array.The text was updated successfully, but these errors were encountered: