▼ |  | File: Racket File Format Libraries

1 | Convertible: Data-Conversion Protocol
2 | gzip Compression and File Creation
3 | gzip Decompression
4 | zip File Creation
5 | tar File Creation
6 | MD5 Message Digest
7 | SHA1 Message Digest
8 | GIF File Writing
9 | ICO File Reading and Writing
10 | Windows Registry
| Bibliography
| Index

On this page:

zip
zip->output
zip-verbose

top← prev up next →

### 4`` zip File Creation

(require file/zip)

The file/zip library provides utilities to create zip archive files, which are compatible with both Windows and Unix (including Mac OS X) unpacking. The actual compression is implemented by deflate.

> procedure (zip zip-file path ...) → void?
> zip-file : path-string?
> path : path-string?

Creates zip-file, which holds the complete content of all paths. The given paths are all expected to be relative path names of existing directories and files (i.e., relative to the current directory). If a nested path is provided as a path, its ancestor directories are also added to the resulting zip file, up to the current directory (using pathlist-closure). Files are packaged as usual for zip files, including permission bits for both Windows and Unix (including Mac OS X). The permission bits are determined by file-or-directory-permissions, which does not preserve the distinction between owner/group/other permissions. Also, symbolic links are always followed.

> procedure (zip->output paths [out]) → void?
> paths : (listof path-string?)
> out : output-port? = (current-output-port)

Zips each of the given paths, and packages it as a zip “file” that is written directly to out. Unlike zip, the specified paths are included as-is; if a directory is specified, its content is not automatically added, and nested directories are added without parent directories.

> parameter (zip-verbose) → boolean?
> (zip-verbose on?) → void?
> on? : any/c

A parameter that controls output during a zip operation. Setting this parameter to a true value causes zip to display to (current-error-port) the filename that is currently being compressed.
top← prev up next →