use same logic for compression

Use same logic for compression across creating files, reading from
files, and checking file existence