Skip to content
Andrew Lambert edited this page Dec 30, 2018 · 18 revisions

PKZip.ZipWriter

Class Declaration

 Protected Class ZipWriter

Remarks

This class is used to create zip archives.

Create a new instance, and then use the AppendDirectory and/or AppendEntry methods to build the archive. When ready, call the Commit method to generate the archive and write it to a file or memory stream.

Limitations

The zip file format limits archives to 4GB, both overall and for individual compressed files. File names, including the path, are limited to 65535 bytes.

The number of files in a single archive is technically limited to 65535, however this class does not enforce the limit. Most zip readers (including the ZipReader class) ignore this limit and can handle archives with any number of files.

Example

  Dim zip As New PKZip.ZipWriter
  Call zip.AppendEntry(GetOpenFolderItem("")) '  add a file to the archive root
  Dim dir As FolderItem = SelectFolder
  zip.AppendDirectory(dir) '  recursively add contents of directory to archive root
  zip.AppendDirectory(dir, dir.Parent) ' recursively add a directory and its contents to archive root
  zip.DeleteEntry("path/to/be/deleted.txt") ' delete an entry
  zip.Commit(SpecialFolder.Desktop.Child("test.zip"))

Methods

Properties

Entry-level points of interest denoted by "☜"



Clone this wiki locally