Read file at ``location`` as binary and yield bytes of up to ``size`` length in bytes, defaulting to 2**24 bytes, e.g., about 16 MB.
(location, size=FILE_CHUNK_SIZE)
| 244 | |
| 245 | |
| 246 | def binary_chunks(location, size=FILE_CHUNK_SIZE): |
| 247 | """ |
| 248 | Read file at ``location`` as binary and yield bytes of up to ``size`` length in bytes, |
| 249 | defaulting to 2**24 bytes, e.g., about 16 MB. |
| 250 | """ |
| 251 | with open(location, "rb") as f: |
| 252 | while True: |
| 253 | chunk = f.read(size) |
| 254 | if not chunk: |
| 255 | break |
| 256 | yield chunk |
| 257 | |
| 258 | |
| 259 | def md5(location): |
no test coverage detected