Git Product home page Git Product logo

Comments (8)

guybedford avatar guybedford commented on July 16, 2024

Also it seems that the "close" event of the Parse stream is causing any of the individual entry stream write streams to stop instantaneously. These files are then never written.

from node-unzip.

guybedford avatar guybedford commented on July 16, 2024

A simplified version of the issue is simply that:

  fs.createReadStream('bootstrap.zip').pipe(unzip.Extract({ path: outDir }));

Is missing out an entire folder in the archive. The archive definitely extracts ok with other unzip methods.

from node-unzip.

rhoegg avatar rhoegg commented on July 16, 2024

I am also noticing duplicate entry events. I tried using this file with the following code:

    fs.createReadStream("xalan-j_2_7_1-bin.zip")
        .pipe(unzip.Parse())
        .on('entry', function(entry) {
            if (entry.type == 'File') {
                console.log("Found entry " + entry.path);
            }
            return entry.autodrain();
        });

It ends up overflowing the stack.

from node-unzip.

idy avatar idy commented on July 16, 2024

I met the same problem. I use this package to extract a xlsx file:

  excel-push-pull Bypass entry: [Content_Types].xml +0ms
  excel-push-pull Bypass entry: _rels/.rels +4ms
  excel-push-pull Bypass entry: _rels/.rels +2ms
  excel-push-pull Bypass entry: xl/_rels/workbook.xml.rels +1ms
  excel-push-pull Bypass entry: xl/_rels/workbook.xml.rels +1ms
  excel-push-pull Bypass entry: xl/workbook.xml +1ms
  excel-push-pull Bypass entry: xl/workbook.xml +1ms
  excel-push-pull Bypass entry: xl/theme/theme1.xml +1ms
  excel-push-pull Bypass entry: xl/theme/theme1.xml +2ms
  excel-push-pull Bypass entry: xl/styles.xml +2ms
  excel-push-pull Bypass entry: xl/styles.xml +1ms
  excel-push-pull Bypass entry: docProps/core.xml +2ms
  excel-push-pull Bypass entry: docProps/core.xml +1ms
  excel-push-pull Bypass entry: docProps/app.xml +0ms
  excel-push-pull Bypass entry: docProps/app.xml +1ms
  excel-push-pull Found strings entry: xl/sharedStrings.xml +1ms
  excel-push-pull Picking: xl/sharedStrings.xml +0ms
  excel-push-pull Found strings entry: xl/sharedStrings.xml +2ms
  excel-push-pull Picking: xl/sharedStrings.xml +0ms
  excel-push-pull Found worksheet entry: xl/worksheets/sheet1.xml +1ms
  excel-push-pull Picking: xl/worksheets/sheet1.xml +0ms
  excel-push-pull Pick: xl/sharedStrings.xml +7ms
  excel-push-pull Found worksheet entry: xl/worksheets/sheet1.xml +1ms
  excel-push-pull Picking: xl/worksheets/sheet1.xml +0ms
  excel-push-pull Pick: xl/sharedStrings.xml +11ms
  excel-push-pull Picking left when closed: 2 +4ms
  excel-push-pull Pick: xl/worksheets/sheet1.xml +170ms

Piping of the second xl/worksheets/sheet1.xml was stopped instantaneously. But not every xlsx file has the problem, I think there must be some different between zips.

Following is the structure of this xlsx file listed by unzip

unzip -l worksheet.xlsx
Archive:  worksheet.xlsx
  Length     Date   Time    Name
 --------    ----   ----    ----
     1168  08-14-14 10:07   [Content_Types].xml
      588  08-14-14 10:07   _rels/.rels
      698  08-14-14 10:07   xl/_rels/workbook.xml.rels
      739  08-14-14 10:07   xl/workbook.xml
     7140  08-14-14 10:07   xl/theme/theme1.xml
     3220  08-14-14 10:07   xl/styles.xml
      593  08-14-14 10:07   docProps/core.xml
      784  08-14-14 10:07   docProps/app.xml
    21806  08-14-14 10:07   xl/sharedStrings.xml
   671612  08-14-14 10:07   xl/worksheets/sheet1.xml
 --------                   -------
   708348                   10 files

from node-unzip.

idy avatar idy commented on July 16, 2024

If load the zip file to buffer, and streamify (I use pull-stream) the buffer to unzip, no duplicated entry found.

from node-unzip.

guybedford avatar guybedford commented on July 16, 2024

@idy thanks for following up. Could you perhaps provide a code example of what you did to bypass the issue? It would be very useful to see.

from node-unzip.

idy avatar idy commented on July 16, 2024

@guybedford I think this should work:

var unzip = require('unzip');
var concat = require('concat-stream');
var rs = ReadStreamOfZipFile;
rs.pipe(concat(function(buf) {
  var ps = require('pullstream');
  ps.write(buf);
  ps.end();
  var stream = ps.pipe(unzip.Parse());
  stream.on('entry', function(entry) { console.log(entry.path); });
}));

I use this way in this file of excel-push-pull.

BTW, this is just a workaround, and it's slower than the stream way, as it loads all data to memory.

from node-unzip.

guybedford avatar guybedford commented on July 16, 2024

@idy thanks so much for posting - I will try this out soon.

from node-unzip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.