On this page:
gzip
gzip-through-ports
deflate

2 gzip Compression and File Creation

 (require file/gzip) package: base
The file/gzip library provides utilities to create archive files in gzip format, or simply to compress data using the pkzip “deflate” method.

procedure

(gzip in-file [out-file])  void?

  in-file : path-string?
  out-file : path-string?
   = (path-add-extension in-file ".gz" #".")
Compresses data to the same format as the gzip utility, writing the compressed data directly to a file. The in-file argument is the name of the file to compress. If the file named by out-file exists, it will be overwritten.

Changed in version 6.8.0.2 of package base: Changed default expression of out-file to use path-add-extension instead of string-append.

procedure

(gzip-through-ports in    
  out    
  orig-filename    
  timestamp)  void?
  in : input-port?
  out : output-port?
  orig-filename : (or/c string? false/c)
  timestamp : exact-integer?
Reads the port in for data and compresses it to out, outputting the same format as the gzip utility. The orig-filename string is embedded in this output; orig-filename can be #f to omit the filename from the compressed stream. The timestamp number is also embedded in the output stream, as the modification date of the original file (in Unix seconds, as file-or-directory-modify-seconds would report on Unix).

Writes pkzip-format “deflated” data to the port out, compressing data from the port in. The data in a file created by gzip uses this format (preceded with header information).

The result is three values: the number of bytes read from in, the number of bytes written to out, and a cyclic redundancy check (CRC) value for the input.