(UNIX only) Return path to a compressed version of the input filename
(f_name: NPath)
| 60 | |
| 61 | @contextmanager |
| 62 | def unix_decompress_file(f_name: NPath) -> t.Generator[str, None, None]: |
| 63 | """(UNIX only) Return path to a compressed version of the input filename""" |
| 64 | subprocess.run(["gunzip", "-kf", f_name], check=True) |
| 65 | f_name_gz = f"{f_name}.gz" |
| 66 | try: |
| 67 | yield f_name_gz |
| 68 | finally: |
| 69 | os.unlink(f_name_gz) |
| 70 | |
| 71 | |
| 72 | @contextmanager |