miurahr / py7zr

7zip in python3 with ZStandard, PPMd, LZMA2, LZMA1, Delta, BCJ, BZip2, and Deflate compressions, and AES encryption.
https://pypi.org/project/py7zr/
GNU Lesser General Public License v2.1
461 stars 74 forks source link

Uploading object to S3 #615

Closed quell01102022 closed 4 weeks ago

quell01102022 commented 2 months ago

Hey, so i can see i can use extract and extractall to write to filesystem. But i need an extracted object to write to S3 Bucket like here:

with py7zr.SevenZipFile("file.7z", "r") as archive:
    for image in archive.namelist():
        s3resource.meta.client.upload_fileobj( archive.open(image), Bucket="bucket", Key="key")

# in zipfile, i can use archive.open() for example, how can i achieve same here?
Ravencentric commented 2 months ago

Use .read()