Until know I used this code for reading zip files:
try:
with open("asset.zip", "rb") as f:
bytes_of_file = f.read()
encoded = base64.b64encode(bytes_of_file)
And it works great then I tried to use large zip files (1GB +), and I got memory error. I tried to use some solution that I saw over the internet:
with zipfile.ZipFile("asset.zip", "rb") as z:
with z.open(...) as f:
bytes_of_file = f.read()
encoded = base64.b64encode(bytes_of_file)
But the problem that zipfile have to open some file inside the zip, and only then I can read it. I want to read the zip file itself and encode it. How can I do it?
Thanks!