compress_file(+quoted_atom, +quoted_atom)

This built-in predicate can compress a file, the file to compress is the first argument. The destination of the compressed data is the file specified by the second argument. The gzip compression algorithm is used, .gz is the default extension for these files. It is possible to open the compressed files with other (de)compression utilities like WinZip or GZip.

arrow.gif (1632 bytes) 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 copy_file/2 current_dir/1 decompress_file/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
compress_file('c:\\temp\\doc.txt', 'c:\\doc.gz'). the file 'doc.txt' is compressed and the compressed data is stored in the file 'c:\doc.gz'

 

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 compress 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
Compression of the file failed a system_error(compress, file, File) exception is thrown

 

 

info@trinc-prolog.com