Skip to content

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

@gizzon

Description

@gizzon

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions