Closed tgulacsi closed 8 years ago
Thanks for your suggestion.
I think this is good idea, but I would like to add this as a special option (to detect zipped files by looking at the content) instead of changing the behavior of the existing --zip
option (as this does have a performance impact, changes existing behavior and can lead to errors with binary files).
It would also be nice to support more file types.
I will create an issue for this and implement it in a future version.
Check the magic first 3 bytes to decide wether to decompress or not.
I use runit's svlogd, and compress the logs with gzip. The resulting file names have a ".s" extension, not ".gz", so sift does not decompress them and skips them.
This PR checks the files' first 3 bytes (as gzip.readHeader) to decide whether the file is gzip-compressed or not.