Created
October 1, 2025 18:15
-
-
Save michalc/9f75550b89397e954023ba69b8a3ce50 to your computer and use it in GitHub Desktop.
Showing that stream-unzip does stream
This file contains hidden or 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
from stream_unzip import stream_unzip | |
data = ( | |
b'PK\x03\x04\n\x00\x00\x00\x00\x00|\x99A[\x82\x89\xd1\xf7\x05\x00\x00\x00\x05\x00\x00\x00\x08' | |
b'\x00\x1c\x00file.txtUT\t\x00\x03\xecn\xddh\xeen\xddhux\x0b\x00\x01\x04\xf6\x01\x00\x00\x04' | |
b'\x14\x00\x00\x00HelloPK\x01\x02\x1e\x03\n\x00\x00\x00\x00\x00|\x99A[\x82\x89\xd1\xf7\x05\x00' | |
b'\x00\x00\x05\x00\x00\x00\x08\x00\x18\x00\x00\x00\x00\x00\x01\x00\x00\x00\xa4\x81\x00\x00\x00' | |
b'\x00file.txtUT\x05\x00\x03\xecn\xddhux\x0b\x00\x01\x04\xf6\x01\x00\x00\x04\x14\x00\x00\x00PK' | |
b'\x05\x06\x00\x00\x00\x00\x01\x00\x01\x00N\x00\x00\x00G\x00\x00\x00\x00\x00' | |
) | |
def input_bytes(): | |
for b in data: | |
print('.', end='') | |
yield bytes([b]) | |
output_bytes = ( | |
b | |
for name, size, chunks in stream_unzip(input_bytes()) | |
for chunk in chunks | |
for b in chunk | |
) | |
for b in output_bytes: | |
print(bytes([b]).decode(), end='') | |
print('') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment