-
It is not clear based on the documentation how I would use stream_zip() for multiple remote files.
It seems to work for 1 file, but more than one gives I'm not sure what I am doing wrong |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Lots of different ways to do it depending on what you need to do per file, but this is one that I think should work: remote_file_list = [...]
files = (
(filename, modified_at, perms, ZIP_64, (get_remote_file(filename).data,))
for filename in remote_file_list
)
stream_zip(files) This does look like it's loading the contents of each uncompressed member file into memory - so potentially it can be improved upon to make it more stream-y. But how to do that depends on what |
Beta Was this translation helpful? Give feedback.
Ah suspect it'll be the
minio_resp.data
... looking at https://min.io/docs/minio/linux/developers/python/API.html#get-object-bucket-name-object-name-offset-0-length-0-request-headers-none-ssec-none-version-id-none-extra-query-params-none,get_object
returns a urllib3.response.HTTPResponse, and looking at https://urllib3.readthedocs.io/en/stable/reference/urllib3.response.html#urllib3.response.HTTPResponse.data, its .data property is a singlebytes
instance - so it would be all the bytes of the response, and in memory at once.However, there is a
stream
function https://urllib3.readthedocs.io/en/stable/reference/urllib3.response.html#urllib3.response.HTTPResponse.stream that instead of a si…