stouputils.archive.repair_zip_file module#

repair_zip_file(file_path: str, destination: str) bool[source]#

Try to repair a corrupted zip file by ignoring some of the errors

This function manually parses the ZIP file structure to extract files even when the ZIP file is corrupted. It reads the central directory entries and attempts to decompress each file individually.

Parameters:
  • file_path (str) – Path of the zip file to repair

  • destination (str) – Destination of the new file

Returns:

Always returns True unless any strong error

Return type:

bool

Examples:

> repair_zip_file("/path/to/source.zip", "/path/to/destination.zip")