Skip to content

Merge zip archives #106

Answered by 101arrowz
emil-peters asked this question in Q&A
Nov 30, 2021 · 3 comments · 4 replies
Discussion options

You must be logged in to vote

First of all, it's very difficult to merge ZIP files efficiently. Unfortunately there's a footer for each ZIP file that is both required and impossible to merge with another footer, so what you're doing won't work. Even if it were possible, please note that the following line is probably going to cause a memory issue:

tmpZippedData = new Uint8Array([...tmpZippedData, ...data]);

The spread operator is efficient for copying arrays but is horrendous for this situation because it creates a standard JS array before converting to Uint8Array; since JS numbers take 32 bits at minimum in V8, you more than quadruple memory usage every time you do this, and its slow. If you want to concatenate Uint8…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@emil-peters
Comment options

@101arrowz
Comment options

Answer selected by 101arrowz
Comment options

You must be logged in to vote
2 replies
@101arrowz
Comment options

@101arrowz
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants