Unzipping a zip directory #55
Replies: 2 comments 5 replies
-
The default should be fine, or indeed any value - the chunk size should only affect performance/memory, and not correctness. Are you able to post the code? |
Beta Was this translation helpful? Give feedback.
-
Yep! Here's a sample i've pulled out with requests.get(url, stream=True) as response:
response.raise_for_status()
for file_name, file_size, file_chunks in stream_unzip(response.iter_content()):
for chunk in file_chunks:
text = TextIOWrapper(BytesIO(chunk), encoding="utf-8", newline="\r\n")
reader = csv.DictReader(text, delimiter=";")
for row in reader:
yield file_name, row This is a zip archive containing 8 files. The first one is always parsed correctly and then depending on how I set the chunk size in |
Beta Was this translation helpful? Give feedback.
-
👋 hey just wondering if you have any guidance on how to go about setting an appropriate chunk size when the zip stream is targeting a directory with many different csv files inside? It seems like depending on the chunk size some of the files will unpack correctly and others will not
Beta Was this translation helpful? Give feedback.
All reactions