Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unzip does not get content on small, nested files. #86

Open
gizzon opened this issue Jan 9, 2023 · 0 comments
Open

Unzip does not get content on small, nested files. #86

gizzon opened this issue Jan 9, 2023 · 0 comments

Comments

@gizzon
Copy link

gizzon commented Jan 9, 2023

I have a nested XML file with a directory structure like: examples > xml_files > default.xml . My default.xml file has a single line within it.

My unzipping code looks like this:

(ts)

   const unzip = new Unzip(stringToByteArray(data));


    for (const fileName of unzip.getFilenames() || []) {
      if (!isDir(fileName)) {
        const content = unzip.decompress(fileName);
        const filename = this.utf16ToUtf8(fileName);

        console.log(filename, content);
    }}

Running this code on the zip mentioned above will work for all files except for the single line default.xml file. If I add an additional line to default.xml, it will parse correctly. Diving into the source codes leaves me to believe that the offset is being calculated incorrectly. Am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant