Decompress a .zst file, returning the path to the decompressed file.
(zst_path)
| 92 | |
| 93 | |
| 94 | def decompress_zst(zst_path): |
| 95 | """Decompress a .zst file, returning the path to the decompressed file.""" |
| 96 | tsv_path = zst_path.removesuffix(".zst") |
| 97 | if os.path.exists(tsv_path): |
| 98 | logger.info("Already decompressed, skipping: %s", tsv_path) |
| 99 | return tsv_path |
| 100 | logger.info("Decompressing %s", zst_path) |
| 101 | result = subprocess.run(["zstd", "-d", "-k", zst_path]) |
| 102 | if result.returncode != 0: |
| 103 | raise RuntimeError(f"Failed to decompress {zst_path}") |
| 104 | return tsv_path |
| 105 | |
| 106 | |
| 107 | def parse_tsv(path): |