Added README and test_chunk

pull/451/head
Matt Trentini 2021-09-10 22:51:03 +10:00
rodzic 77255dc11e
commit dfa05a4771
3 zmienionych plików z 25 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,7 @@
# Chunk
Imported `chunk.py` from the CPython stdlib at version
ac7b1a3f32cc81520e8962352294006d65744028.
`test_chunk.py` was created as a simple test to chunkify the MicroPython logo
(in tiff format) and ensure chunk didn't obviously fail.

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -0,0 +1,18 @@
from chunk import Chunk
from micropython import const
logo = open("micropython-logo.tiff", "rb")
CHUNK_SIZE = const(23) # Arbitrary size
while True:
try:
chunk = Chunk(logo)
except EOFError:
break
chunktype = chunk.getname()
while True:
data = chunk.read(CHUNK_SIZE)
if not data:
break
print(data)