# Module zipfiles

This module implements a zip archive creator/reader/modifier.

# Imports

streams, libzip, times, os

# Types

    TZipArchive* = object of TObject
      mode: TFileMode
      w: PZip

  represents a zip archive

    PZipFileStream* = ref TZipFileStream

  a reader stream of a file within a zip archive

# Procs

    proc open*(z: var TZipArchive; filename: string; mode: TFileMode = fmRead): bool

  Opens a zip file for reading, writing or appending. All file modes are supported. Returns true iff successful, false otherwise.

    proc close*(z: var TZipArchive)

  Closes a zip file.

    proc createDir*(z: var TZipArchive; dir: string)

  Creates a directory within the z archive. This does not fail if the directory already exists. Note that for adding a file like `"path1/path2/filename"` it is not necessary to create the `"path/path2"` subdirectories - it will be done automatically by `addFile`.

    proc addFile*(z: var TZipArchive; dest, src: string)

  Adds the file src to the archive z with the name dest. dest may contain a path that will be created.

    proc addFile*(z: var TZipArchive; file: string)

  A shortcut for `addFile(z, file, file)`, i.e. the name of the source is the name of the destination.

    proc addFile*(z: var TZipArchive; dest: string; src: PStream)

  Adds a file named with dest to the archive z. dest may contain a path. The file's content is read from the src stream.

    proc getStream*(z: var TZipArchive; filename: string): PZipFileStream

  returns a stream that can be used to read the file named filename from the archive z. Returns nil in case of an error. The returned stream does not support the setPosition, getPosition, writeData or atEnd methods.

    proc extractFile*(z: var TZipArchive; srcFile: string; dest: PStream)

  extracts a file from the zip archive z to the destination stream.

    proc extractFile*(z: var TZipArchive; srcFile: string; dest: string)

  extracts a file from the zip archive z to the destination filename.

    proc extractAll*(z: var TZipArchive; dest: string)

  extracts all files from archive z to the destination directory.

# Iterators

    iterator walkFiles*(z: var TZipArchive): string

  walks over all files in the archive z and returns the filename (including the path).

Generated: 2012-09-23 21:47:54 UTC