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

extractEntryTo doesn't gets Entry Folder

Open timheerwagen opened this issue 3 years ago • 0 comments

I zip a folder from my backend with

if (fs.existsSync(`${dir}upload`)) {
      file.addLocalFolder(`${dir}upload`, "upload/");
    }

and download it in my frontend. The zip is exported correctly. Then i upload it again to test if i can unzip it again in my backend with

zip.extractEntryTo(
        "upload/",
        `${dir}/`,
        false,
        true
      );

And i get the error message "uncaughtException: Error: Entry doesn't exist" but if i extract a subfolder of upload for Example upload/product/ it works fine.

So this works:

zip.extractEntryTo(
        "upload/product/",
        `${dir}/`,
        false,
        true
      );

But this doesn't:

zip.extractEntryTo(
        "upload/",
        `${dir}/`,
        false,
        true
      );

I even tried when zip the file putting the upload folder in a subfolder for Example doing export/upload/ But this doesn't work either. There again only the subpath export/upload/product/ works.

When using extractAllTo it also works.

timheerwagen avatar Jan 22 '22 12:01 timheerwagen