Checks if the given file is a Gzip file based on the header. Args: filename (pathlib.Path): The path to the file to be checked. Returns: bool: True if the file starts with the Gzip header, False otherwise.
(filename: pathlib.Path)
| 141 | |
| 142 | |
| 143 | def is_gzip(filename: pathlib.Path) -> bool: |
| 144 | """ |
| 145 | Checks if the given file is a Gzip file based on the header. |
| 146 | |
| 147 | Args: |
| 148 | filename (pathlib.Path): The path to the file to be checked. |
| 149 | |
| 150 | Returns: |
| 151 | bool: True if the file starts with the Gzip header, False otherwise. |
| 152 | """ |
| 153 | gzip_header = b"\x1f\x8b" |
| 154 | with open(filename, "rb") as thefile: |
| 155 | return thefile.read(2) == gzip_header |
| 156 | |
| 157 | |
| 158 | def decompress_gzip( |