Created
January 3, 2022 16:37
-
-
Save michalc/eb43718fcf1d5d8285e2c9c7fe97d409 to your computer and use it in GitHub Desktop.
Generating a Zip 2.0 file that's (just under) 8GiB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Often it's claimed that a Zip 2.0 file cannot be bigger than 4GiB | |
# Here's how to make one that's just under 8GiB | |
from datetime import datetime | |
from stream_zip import stream_zip, ZIP_32 | |
now = datetime.now() | |
perms = 0o600 | |
def files(): | |
for i in range(0, 0xffff): | |
yield str(i).zfill(5) + '-' * 65484, now, perms, ZIP_32, (b'',) | |
with open('8gb.zip', 'wb') as f: | |
for chunk in stream_zip(files()): | |
f.write(chunk) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment