mxmlnkn / rapidgzip

Gzip Decompression and Random Access for Modern Multi-Core Machines
Apache License 2.0
364 stars 7 forks source link

option to delete orig file after uncompress #35

Closed tooptoop4 closed 6 months ago

tooptoop4 commented 6 months ago

option to delete orig file after uncompress

mxmlnkn commented 6 months ago

Is that really necessary? At this point, when there is an extra option, why not simply do rapidgzip -d "$file" && rm -- "$file" instead? And, currently, I'm definitely against the established behavior of deleting the file by default except when --keep is specified. I always found that behavior unexpected and potentially dangerous, e.g., when there were undetected decoding errors, especially in combination with the --no-verify option.

(It would only make sense to have such an option if it would enable a kind of in-place decompression, e.g., by truncating the already decoded parts of the compressed file to allow decompression of very large files when there is insufficient memory on disk to have both, the compressed and uncompressed file around. But then, the problem with file integrity becomes even worse because decompression errors might only be detected after parts of the file have already been decompressed and truncated. And normally, the decompressed file would be much larger than the compressed file, so it might not fit on a drive anyway even with truncating the compressed file. And then, you would have the same problem of possibly half-decoded and truncated files when the out-of-space error is detected. It's difficult.)