This built-in predicate can decompress a file, the file to decompress is the first
argument. The original name of the uncompressed file is read from the compressed file and
in the same directory a destination file with that name is created.
For instance: the file to decompress is 'win.gz', in that file the original name of the
file is stored: 'win.txt', if decompress_file/1 is used a file 'win.txt' is created and
used for writing the uncompressed data to.
| The text editor of Trinc-Prolog automatically decompresses .gz files, it is also possible to compress a file by selecting it to save it as a .gz file. |
see also: app_dir/1 base64_decode_file/2 base64_encode_file/2 compress_file/2 copy_file/2 current_dir/1 decompress_file/2 decrypt_file/3 delete_file/1 encrypt_file/3 exists_dir/1 exists_file/1 info_file/2 make_dir/1 md5_file/2 next_file/2 next_file/3 next_dir/2 remove_dir/1 rename_file/2 set_current_dir/1 split_fn/2 unlink_file/1 wipe_file/1
| Examples | |
| decompress_file('c:\\temp\\doc.gz') | the original file name is read from the compressed file, for instance: 'doc.txt', the file 'c:\\temp\\doc.txt' is created and the uncompressed data is written to that file |
| Exceptions | |
| The argument is an empty variable | an instantiation_error exception is thrown |
| The argument Arg is not an atom enclosed by single or double quotes | a type_error(atom_singlequotes, Arg) exception is thrown |
| The File to decompress cannot be opened for reading | an existence_error(file, File) exception is thrown |
| To the destination File cannot be written | a permission_error(write, file, File) exception is thrown |
| Decompression of the file failed | a system_error(decompress, file, File) exception is thrown |