Comments (14)
To note, the corrupt archives all had the same file size, but a hex comparison showed that there were several places in the archive where data had been shifted around. I assumed that chunks of each stream were perhaps being incorrectly interleaved.
from node-archiver.
you may want to listen for the close
event of output
stream (to do your callback), as finalize
doesn't guarantee that your streams have finished dealing with the data sent to them.
from node-archiver.
since archiver can handle being passed files right after each other and then dealing dealing with it internally 1 by 1. you really shouldn't need async at all on that part and there is a nice little helper for lazy loading streams that should ease open file limits.
https://npmjs.org/package/lazystream
from node-archiver.
@ctalkington I just had time to look into this finally, and you were 100% correct about waiting for events on the output stream. Thanks!
from node-archiver.
Actually, I lied, still hitting some issues. They appear to be the same as #38
from node-archiver.
yah, i really need to get a test environment for Mac so I can see whats going on as I have been unable to reproduce to this point.
from node-archiver.
bit of update from discoveries, this corruption seems to happen more when you are writing multiple zips at once and only when the source is a buffer and goes through zlib.
i messed with this some more, it appears if JUST the line to checksum is removed from the DeflateRawChecksum
, it doesn't go crazy and start overwriting itself.
from node-archiver.
also to be noted this corruption also happens randomly and some times its none, one, two, or all the zips that end up corrupt. It almost makes me feel like its a global leak or there is some memory corruption going on from all the buffers being created. yet that doesn't really fit with the DeflateRawChecksum
line removal fixing it...
EDIT: after the latest commits the DeflateRawChecksum
line removal seems to have been a fluke as its back to erroring. I think its still related to something with buffers.
from node-archiver.
cc @ampgcat
from node-archiver.
during testing, it was found that a higher internal buffer highWaterMark
seemed to reduce the occurrence of the issue cropping up. i will be releasing a bugfix in the next day with such a change as a temporary solution.
from node-archiver.
ok, im hoping the latest release eliminates the issue. i spent way too much trying to track down why deflate.pipe was causing such a random race condition so I've moved it back to event listeners for the time being.
from node-archiver.
It does fix my issue with corrupt zip files... Thanks ๐
from node-archiver.
closing. please open new issue if issue remains.
from node-archiver.
Thank you @ctalkington for researching and fixing this! <3
from node-archiver.
Related Issues (20)
- ๅ็ผฉๅๆไปถ็ไฟฎๆนๆถ้ดไธๆญฃ็กฎ
- achiver.directory can't use, error with input source must be valid Stream or Buffer instance error HOT 1
- How to zip single file HOT 1
- Dependency Dashboard
- ESM HOT 1
- .directory() generate a empty folder, compress completed will remove the empty folder,could I retain the empty folder?
- Class extends value undefined is not a constructor or null HOT 1
- Is there a way to know how many files were ultimately compressed? HOT 2
- Question: Were there any API changes from 5.3 to 6.x? HOT 1
- Recommendation for an unzip library? HOT 1
- Overwrite existing files
- Missing Release of Resource after Effective Lifetime [High Severity] HOT 1
- zlib level 0 stops the progress of ongoing read streams
- Improve docs around append callback? HOT 1
- How to convert csv to 7z HOT 1
- Heap out of memory with archiver.append() HOT 1
- Append CSV file line by line
- `append()` fails after upgrading from v6 to v7 HOT 4
- Cannot add file named `\` HOT 2
- Archiver Version 7.0 might be breaking due to ESM HOT 1
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-archiver.