Read all the files and check the CRC.
(self)
| 1473 | file=file) |
| 1474 | |
| 1475 | def testzip(self): |
| 1476 | """Read all the files and check the CRC.""" |
| 1477 | chunk_size = 2 ** 20 |
| 1478 | for zinfo in self.filelist: |
| 1479 | try: |
| 1480 | # Read by chunks, to avoid an OverflowError or a |
| 1481 | # MemoryError with very large embedded files. |
| 1482 | with self.open(zinfo.filename, "r") as f: |
| 1483 | while f.read(chunk_size): # Check CRC-32 |
| 1484 | pass |
| 1485 | except BadZipFile: |
| 1486 | return zinfo.filename |
| 1487 | |
| 1488 | def getinfo(self, name): |
| 1489 | """Return the instance of ZipInfo given 'name'.""" |