Comments (8)
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.
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.
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.
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.
If load the zip file to buffer, and streamify (I use pull-stream
) the buffer to unzip
, no duplicated entry found.
from node-unzip.
@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.
@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.
@idy thanks so much for posting - I will try this out soon.
from node-unzip.
Related Issues (20)
- enhancement: Set option for deletion
- `me.error` is not a function HOT 1
- Error: invalid signature: 0x6064b50 HOT 2
- When using with typescript,the process may crash HOT 1
- Pipe signature on Entry
- Error: invalid signature: 0x70a4935 HOT 1
- Please remove dependency on 'natives HOT 5
- Does not work with nodejs v10.0.0 HOT 5
- Don't use under electron-main HOT 3
- extracted files corrupted HOT 1
- folder as file HOT 1
- DO NOT USE THIS THING HOT 8
- Not working with Node 12, primordials is not defined HOT 4
- Mode not preserved with Extract
- Update fstream to a secure version HOT 5
- Any way to pass in arguments like -j or -d from normal unzip?
- Dependency needs updating
- How to stop decompressing zip?
- primordials HOT 2
- unzipper.Parse doesn't work
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-unzip.