Zip PureBasic Reference Documentation

Zip

Zip compression component.

Object Creation

obj.i = CkZip::ckCreate()

; Make sure to dispose of the object when finished like this:
CkZip::ckDispose(obj);

Properties

Declare.i ckAbortCurrent(obj.i)
Declare setCkAbortCurrent(obj.i, value.i)

Introduced in version 9.5.0.58

When set to 1, causes the currently running method to abort. Methods that always finish quickly (i.e.have no length file operations or network communications) are not affected. If no method is running, then this property is automatically reset to 0 when the next method is called. When the abort occurs, this property is reset to 0. Both synchronous and asynchronous method calls can be aborted. (A synchronous method call could be aborted by setting this property from a separate thread.)

Declare.s ckAppendFromDir(obj.i)
Declare setCkAppendFromDir(obj.i, value.s)

When files are added to a Zip archive, they are appended from this directory. For example, to add all the files under c:/abc/123/myAppDir, this property could be set to "c:/abc/123", and "myAppDir/*" would be passed to AppendFiles. The path that is saved in the .zip would be "myAppDir/". (The value of the AppendFromDir property does not become part of the file path saved in the .zip.)

Controlling Paths of Files Added to Zip

Declare.i ckCaseSensitive(obj.i)
Declare setCkCaseSensitive(obj.i, value.i)

If 1 then all methods that get or search for zip entries by name will use case-sensitive filename matching. If 0 then filename matching will be case insensitive. Methods affected by this property include GetEntryByName, UnzipMatching, FirstMatchingEntry, etc.

The default value is 0.

Declare.i ckClearArchiveAttribute(obj.i)
Declare setCkClearArchiveAttribute(obj.i, value.i)

Set this to 1 to clear the FILE_ATTRIBUTE_ARCHIVE file attribute of each file during a zipping operation.

The default value is 0.

Declare.i ckClearReadOnlyAttr(obj.i)
Declare setCkClearReadOnlyAttr(obj.i, value.i)

If 1, the read-only attribute is automatically cleared when unzipping. The default value of this property is 0, which leaves the read-only attribute unchanged when unzipping.

Declare.s ckComment(obj.i)
Declare setCkComment(obj.i, value.s)

The global Zip file comment.

Declare.s ckDebugLogFilePath(obj.i)
Declare setCkDebugLogFilePath(obj.i, value.s)

If set to a file path, causes each Chilkat method or property call to automatically append it's LastErrorText to the specified log file. The information is appended such that if a hang or crash occurs, it is possible to see the context in which the problem occurred, as well as a history of all Chilkat calls up to the point of the problem. The VerboseLogging property can be set to provide more detailed information.

This property is typically used for debugging the rare cases where a Chilkat method call hangs or generates an exception that halts program execution (i.e. crashes). A hang or crash should generally never happen. The typical causes of a hang are:

  1. a timeout related property was set to 0 to explicitly indicate that an infinite timeout is desired,
  2. the hang is actually a hang within an event callback (i.e. it is a hang within the application code), or
  3. there is an internal problem (bug) in the Chilkat code that causes the hang.

Declare.s ckDecryptPassword(obj.i)
Declare setCkDecryptPassword(obj.i, value.s)

When opening a password-protected or AES encrypted Zip, this is the password to be used for decryption. Encrypted Zips may be opened without setting a password, but the contents cannot be unzipped without setting this password.

Note:The SetPassword method has the effect of setting both this property as well as the EncryptPassword property. The SetPassword method should no longer be used. It has been replaced by the DecryptPassword and EncryptPassword properties to make it possible to open an encrypted zip and re-write it with a new password.

Declare.i ckDiscardPaths(obj.i)
Declare setCkDiscardPaths(obj.i, value.i)

If 1, discards all file path information when zipping. The default value is 0.

Declare.i ckEncryption(obj.i)
Declare setCkEncryption(obj.i, value.i)

Indicate whether the Zip is to be strong encrypted or not. Valid values are 0 (not encrypted) or 4 (AES encrypted). When this property is set to the value 4, WinZip AES compatible encrypted zip archives are produced.

Note: Prior to Chilkat v9.4.1, other possible values for this property were: 1 (blowfish), 2 (twofish), and 3 (rijndael). These settings originally provided a way to produce strong encrypted zips prior to when the AES encrypted Zip standard existed. Using these legacy values (1, 2, or 3) produced encrypted zips that only applications using Chilkat could read. Chilkat no longer supports these custom modes of encryption. If using an older version of Chilkat with one of these deprecated encryption modes, make sure to decrypt using the old Chilkat version and re-encrypt using mode 4 (WinZip compatible AES encryption) prior to updating to the new Chilkat version.

Important:The Encryption and PasswordProtect properties are mutually exclusive. PasswordProtect corresponds to the older Zip 2.0 encryption, commonly referred to as a "password-protected" zip. If the PasswordProtect is set to 1, the Encryption property should be set to 0. If the Encryption property is set to a non-zero value, then PasswordProtect should be set to 0. A zip cannot be both password-protected and strong-encrypted.

Declare.i ckEncryptKeyLength(obj.i)
Declare setCkEncryptKeyLength(obj.i, value.i)

The encryption key length if AES, Blowfish, Twofish, or WinZip-compatible AES encryption is used. This value must be 128, 192, or 256. The default value is 128.

Declare.s ckEncryptPassword(obj.i)
Declare setCkEncryptPassword(obj.i, value.s)

The password used when writing a password-protected or strong-encrytped Zip.

Note:The SetPassword method has the effect of setting both this property as well as the DecryptPassword property. The SetPassword method should no longer be used. It has been replaced by the DecryptPassword and EncryptPassword properties to make it possible to open an encrypted zip and re-write it with a new password.

Declare.i ckFileCount(obj.i) ; (read-only)

The number of files (excluding directories) contained within the Zip.

Declare.s ckFileName(obj.i)
Declare setCkFileName(obj.i, value.s)

The path (absolute or relative) of the Zip archive. This is the path of the file that is created or overwritten when the zip is saved.

Declare.i ckHasZipFormatErrors(obj.i) ; (read-only)

1 if the opened zip contained file format errors (that were not severe enough to prevent the zip from being opened and parsed).

Declare.i ckIgnoreAccessDenied(obj.i)
Declare setCkIgnoreAccessDenied(obj.i, value.i)

If 1, then files that cannot be read due to "access denied" (i.e. a file permission error) will be ignored and the call to WriteZip, WriteZipAndClose, WriteExe, etc. will return a success status. If 0, then the "access denied" filesystem errors are not ignored and any occurrence will cause the zip writing to fail. The default value is 1.

Declare.s ckLastErrorHtml(obj.i) ; (read-only)

Provides information in HTML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

Declare.s ckLastErrorText(obj.i) ; (read-only)

Provides information in plain-text format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

Concept of LastErrorText

LastErrorText Standard Information

Declare.s ckLastErrorXml(obj.i) ; (read-only)

Provides information in XML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

Declare.i ckLastMethodSuccess(obj.i)
Declare setCkLastMethodSuccess(obj.i, value.i)

Introduced in version 9.5.0.52

Indicate whether the last method call succeeded or failed. A value of 1 indicates success, a value of 0 indicates failure. This property is automatically set for method calls. It is not modified by property accesses. The property is automatically set to indicate success for the following types of method calls:

  • Any method that returns a string.
  • Any method returning a Chilkat object, binary bytes, or a date/time.
  • Any method returning a standard boolean status value where success = 1 and failure = 0.
  • Any method returning an integer where failure is defined by a return value less than zero.

Note: Methods that do not fit the above requirements will always set this property equal to 1. For example, a method that returns no value (such as a "void" in C++) will technically always succeed.

Declare.i ckNumEntries(obj.i) ; (read-only)

The number of entries in the Zip, including both files and directories.

Declare.i ckOemCodePage(obj.i)
Declare setCkOemCodePage(obj.i, value.i)

Sets the OEM code page to be used for Unicode filenames. This property defaults to the OEM code page of the computer.

Declare.i ckOverwriteExisting(obj.i)
Declare setCkOverwriteExisting(obj.i, value.i)

Determines whether existing files are overwritten during unzipping. The default is 1, which means that already-existing files will be overwritten. Set this property = 0 to prevent existing files from being overwritten when unzipping.

Declare.i ckPasswordProtect(obj.i)
Declare setCkPasswordProtect(obj.i, value.i)

1 if the Zip should be password-protected using older Zip 2.0 encryption, commonly referred to as "password-protection".

This property is set when a zip archive is opened by any of the Open* methods, such as OpenZip, OpenFromMemory, etc.

Declare.s ckPathPrefix(obj.i)
Declare setCkPathPrefix(obj.i, value.s)

A prefix that is added to each filename when zipping. One might set the PathPrefix to "subdir/" so that files are unzipped to a specified subdirectory when unzipping.

How to Add a Directory Path to Files when Zipping

Declare.s ckTempDir(obj.i)
Declare setCkTempDir(obj.i, value.s)

The temporary directory to use when unzipping files. When running in ASP or ASP.NET, the default value of TempDir is set to the directory where the .zip is being written. Set this property to override the default.

Declare.i ckTextFlag(obj.i)
Declare setCkTextFlag(obj.i, value.i)

If set to 1, the component will set the "text flag" for each file having these filename extensions: .txt, .xml, .htm, and .html. It will also preserve the "text flag" for existing zips that are opened and rewritten. By default, this property is set to 0.

It is generally not necessary to set the text flag for a zip entry.

Declare.i ckVerboseLogging(obj.i)
Declare setCkVerboseLogging(obj.i, value.i)

If set to 1, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is 0. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.

Declare.s ckVersion(obj.i) ; (read-only)

Version of the component/library, such as "9.5.0.63"

Declare.i ckZipx(obj.i)
Declare setCkZipx(obj.i, value.i)

Starting in v9.4.1, Chilkat Zip will automatically unzip ZIPX files using any of the following compression methods: BZIP2, PPMd, LZMA, and Deflate64 ("Deflate64" is a trademark of PKWare, Inc.)

This property, however, controls whether or not a ZipX is automatically produced where the best compression algorithm for each file is automatically chosen based on file type. This property is for writing zip archives. It does not apply to when unzipping ZIPX archives, Chilkat Zip automatically handles the various compression algorithms when unzipping.

Declare.s ckZipxDefaultAlg(obj.i)
Declare setCkZipxDefaultAlg(obj.i, value.s)

The default compression algorithm to be used when creating ZIPX archives. The default value is "deflate". Other possible values are "ppmd", "lzma", "bzip2" and "deflate64". When writing a ZIPX archive, if the file extension does not indicate an obvious choice for the appropriate compression algorithm, then the ZipxDefaultAlg is used.

Methods

Declare ckAddNoCompressExtension(obj.i, fileExtension.s)

Attempting to compress already-compressed data is usually a waste of CPU cycles with little or no benefit. In fact, it is possible that attempting to compress already-compressed data results in a slightly increased size. The Zip file format allows for files to be "stored" rather than compressed. This allows the file data to be streamed directly into a .zip without compression.

An instance of the Zip object has an internal list of "no compress" extensions. A filename with a "no compress" extension is "stored" rather than compressed. Additional "no compress" extensions may be added by calling this method (once per file extension). You should pass the file extension, such as ".xyz" in fileExtension.

"no compress" extensions may be removed by calling RemoveNoCompressExtension.

The default "no compress" extensions are: .zip, .gif, .jpg, .gz, .rar, .jar, .tgz, .bz2, .z, .rpm, .msi, .png

Declare.i ckAppendBase64(obj.i, fileName.s, encodedCompressedData.s)

Creates a new Zip entry and initializes it with already-compressed data that is Base64 encoded. (The ZipEntry.CopyBase64 method can be used to retrieve the compressed data in Base64 format.)

Note 1: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Note 2: It is assumed that the compressed data is unencrypted deflated data. (Meaning data compressed using the "deflate" compression algorithm.)

Returns 0 on failure

Declare.i ckAppendBd(obj.i, pathInZip.s, byteData.i)

Introduced in version 9.5.0.70

Appends the contents of byteData as a new entry to this zip object. The zip entry object containing the data is returned.

Returns 0 on failure

Backup Windows Current User / Personal Certificates to a .zip

Declare.i ckAppendDataEncoded(obj.i, filename.s, encoding.s, argData.s)

Introduced in version 9.5.0.59

Appends in-memory data as a new entry to a Zip object. The filename is the filename of the entry as it will appear within the zip. The encoding is the encoding of the data, such as "base64", "hex", etc. The full list of encodings is listed at the web page linked below.

Returns the zip entry object.

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns 0 on failure

Binary Encodings Supported by Chilkat

Declare.i ckAppendFiles(obj.i, filePattern.s, recurse.l)

Appends one or more files to the Zip object. The filePattern can use the "*" wildcard character for 0 or more of any characterSet recurse equal to True to recursively add all subdirectories, or False to only add files in the current directory.

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns 1 for success, 0 for failure.

Controlling paths within a Zip

Declare.i ckAppendFilesAsync(obj.i, filePattern.s, recurse.l)

Creates an asynchronous task to call the AppendFiles method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns 0 on failure

How to Run an Asynchronous Task

Declare.i ckAppendFilesEx(obj.i, filePattern.s, recurse.l, saveExtraPath.l, archiveOnly.l, includeHidden.l, includeSystem.l)

Appends one or more files to the Zip object. The filePattern can use the "*" and "?" wildcard characters where "*" means 0 or more of any character and "?" means any single character. The recurse controls whether directories are recursively traversed. Set recurse equal to 1 to append files and subdirectories in the directory tree. Set recurse equal to 0 to add files only from the indicated directory.

The saveExtraPath only applies when the filePattern is an absolute path pattern, such as "C:/temp/abc/*.txt". If saveExtraPath is 1, then the absolute path will be included in the zip entry filenames as relative paths. For example, "temp/abc/xyz.txt".

The archiveOnly, archiveOnly, and includeHidden flags only apply when on the Windows operating system. These flags control whether files with the Archive, Hidden, or System attributes are included.

Note: This method does not write the zip archive. It simply adds references to the files that will be included in the .zip when the WriteZip or WriteZipAndClose methods are eventually called. Files and/or data may be added to the zip object by calling any combination of the Append* methods before finally writing the zip via one of the Write* methods.

Returns 1 for success, 0 for failure.

Declare.i ckAppendFilesExAsync(obj.i, filePattern.s, recurse.l, saveExtraPath.l, archiveOnly.l, includeHidden.l, includeSystem.l)

Creates an asynchronous task to call the AppendFilesEx method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns 0 on failure

How to Run an Asynchronous Task

Declare.i ckAppendHex(obj.i, fileName.s, encodedCompressedData.s)

Creates a new Zip entry and initializes it with already-compressed data that is hexidecimal encoded. (The ZipEntry.CopyHex method can be used to retrieve the compressed data in Hex format.)

Note 1: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Note 2: It is assumed that the compressed data is unencrypted deflated data. (Meaning data compressed using the "deflate" compression algorithm.)

Returns 0 on failure

Declare.i ckAppendMultiple(obj.i, fileSpecs.i, recurse.l)

This method is the same as calling AppendFiles multiple times - once for each file pattern in fileSpecs

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns 1 for success, 0 for failure.

Declare.i ckAppendMultipleAsync(obj.i, fileSpecs.i, recurse.l)

Creates an asynchronous task to call the AppendMultiple method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns 0 on failure

How to Run an Asynchronous Task

Declare.i ckAppendNew(obj.i, fileName.s)

Appends a new and empty entry to the Zip object and returns the ZipEntry object. Data can be appended to the entry by calling ZipEntry.AppendData.

Important: To append an already-existing file, call the AppendOneFileOrDir method. The AppendNew method inserts a new and empty file entry within the Zip object. The purpose of AppendNew is to either create an empty file within the Zip, or to create a new file entry which can then be filled with data by calling the entry's AppendData method.

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns 0 on failure

Declare.i ckAppendNewDir(obj.i, dirName.s)

Adds an entry to the zip so that when it unzips, a new directory (with no files) is created. The directory does not need to exist on the local filesystem when calling this method. The dirName is simply a string that is used as the directory path for the entry added to the zip. The zip entry object is returned.

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns 0 on failure

Declare.i ckAppendOneFileOrDir(obj.i, fileOrDirPath.s, saveExtraPath.l)

Appends a single file or directory to the Zip object. The saveExtraPath applies when fileOrDirPath is an absolute (non-relative) path. If saveExtraPath is 1, then the absolute path is made relative and saved in the zip. For example, if the fileOrDirPath is "C:/temp/xyz/test.txt" and saveExtraPath is 1, then the path in the zip will be "./temp/xyz/test.txt". If however, fileOrDirPath contains a relative path, then saveExtraPath has no effect.

Returns 1 for success, 0 for failure.

Set Entry Filepath (in output Zip) when Zipping

Declare.i ckAppendOneFileOrDirAsync(obj.i, fileOrDirPath.s, saveExtraPath.l)

Creates an asynchronous task to call the AppendOneFileOrDir method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns 0 on failure

How to Run an Asynchronous Task

Declare.i ckAppendString(obj.i, internalZipFilepath.s, textData.s)

Adds an in-memory string to the Zip object. The textData argument is converted to the ANSI charset before being added to the Zip. If the Zip were written to disk by calling WriteZip, and later unzipped, the entry would unzip to an ANSI text file.

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns 0 on failure

Declare.i ckAppendString2(obj.i, internalZipFilepath.s, textData.s, charset.s)

Same as AppendString, but allows the charset to be specified. The textData is converted to charset before being added to the zip. The internalZipFilepath is the path of the file that will be stored within the zip.

Note: This method only updates the zip object. To update (rewrite) a zip file, either the WriteZip or WriteZipAndClose method would need to be called.

Returns 0 on failure

Create a Zip Entirely in Memory

Declare.i ckAppendZip(obj.i, zipFileName.s)

Adds the contents of another existing Zip file to this Zip object.

Returns 1 for success, 0 for failure.

Declare ckCloseZip(obj.i)

Closes an open Zip file. This is identical to calling NewZip. (NewZip closes the current Zip file, if open, and initializes the Zip object to be empty. Zip files are only created when WriteZip is called.)

Declare.i ckDeleteEntry(obj.i, entry.i)

Removes a Zip entry from the calling Zip object.

Returns 1 for success, 0 for failure.

Remove a File from a .zip

Declare ckExcludeDir(obj.i, dirName.s)

Adds a directory name to be excluded when AppendFiles is called to add an entire directory tree. All directories having a name equal to an excluded directory will not be included when AppendFiles (or AppendFileEx) is called. Multiple directories can be excluded by calling ExcludeDir multiple times. The name comparison is case-insensitive.

Declare.i ckExtract(obj.i, dirPath.s)

Unzip all the files into the specified directory. Subdirectories are automatically created as needed.

Returns 1 for success, 0 for failure.

Declare.i ckExtractAsync(obj.i, dirPath.s)

Creates an asynchronous task to call the Extract method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns 0 on failure

How to Run an Asynchronous Task

Declare.i ckExtractInto(obj.i, dirPath.s)

Unzips all the files in a Zip into a single directory regardless of the path stored in the Zip

Returns 1 for success, 0 for failure.

Declare.i ckExtractMatching(obj.i, dirPath.s, pattern.s)

Unzip all files matching a wildcard pattern.

Returns 1 for success, 0 for failure.

Declare.i ckExtractNewer(obj.i, dirPath.s)

Extracts only the files that have more recent last-modified-times than the files on disk. This allows you to easily refresh only the files that have been updated.

Returns 1 for success, 0 for failure.

Declare.i ckExtractOne(obj.i, entry.i, dirPath.s)

This method is deprecated. It will be removed in a future version.

Identical to calling ZipEntry.Extract. This method is deprecated and the Extract method of the zip entry should be called instead.

Returns 1 for success, 0 for failure.

Declare.i ckFirstEntry(obj.i)

Return the first entry in the Zip. Call ZipEntry.NextEntry to iterate over the entries in a Zip until a NULL is returned.

Returns 0 on failure

Declare.i ckFirstMatchingEntry(obj.i, pattern.s)

Returns the first entry having a filename matching a pattern. The "*" characters matches 0 or more of any character. The full filename, including path, is used when matching against the pattern. A NULL is returned if nothing matches.

Returns 0 on failure

Iterate over Matching Filenames

Declare.s ckGetDirectoryAsXML(obj.i)

Return the contents of the Zip file directory in an XML formatted string

Returns an empty string on failure. Use the LastMethodSuccess property to check for success.

Declare.i ckGetEntryByID(obj.i, entryID.l)

Retrieves a ZipEntry by ID. Chilkat Zip.NET automatically assigns a unique ID to each ZipEntry in the Zip. This feature makes it easy to associate an item in a UI control with a ZipEntry.

Returns 0 on failure

Declare.i ckGetEntryByIndex(obj.i, index.l)

Retrieves a ZipEntry by index. The first entry is at index 0. This will return directory entries as well as files.

Returns 0 on failure

Declare.i ckGetEntryByName(obj.i, entryName.s)

Returns a ZipEntry by filename. If a full or partial path is part of the filename, this must be included in the filename parameter.

Returns 0 on failure

Download a Zip from a URL and OpenFromMemory. (No .zip fie is created)

Set Entry Filepath (in output Zip) when Zipping

Declare.i ckGetExclusions(obj.i)

Returns the current collection of exclusion patterns that have been set by SetExclusions.

Returns 0 on failure

Declare.i ckInsertNew(obj.i, fileName.s, beforeIndex.l)

Inserts a new and empty entry into the Zip object. To insert at the beginning of the Zip, beforeIndex should be 0. The ZipEntry's FileName property is initialized to fileName parameter.

Returns 0 on failure

Declare.i ckIsNoCompressExtension(obj.i, fileExtension.s)

Returns 1 if the fileExtension is contained in the set of "no compress" extensions, otherwise returns 0. (See the documentation for the AddNoCompressExtension method.) The fileExtension may be passed with or without the ".". For example, both ".jpg" and "jpg" are acceptable.

Declare.i ckIsPasswordProtected(obj.i, zipFilename.s)

Return True if a Zip file is password protected

Declare.i ckIsUnlocked(obj.i)

Returns True if the class is already unlocked, otherwise returns False.

Declare.i ckNewZip(obj.i, zipFilePath.s)

Clears and initializes the contents of the Zip object. If a Zip file was open, it is closed and all entries are removed from the object. The FileName property is set to the zipFilePath argument.

Chilkat Zip API Concepts

Declare.i ckOpenBd(obj.i, binData.i)

Introduced in version 9.5.0.66

Open a Zip contained in binData.

When a zip is opened, the PasswordProtect and Encryption properties will be appropriately set. If the zip is password protected (i.e. uses older Zip 2.0 encrypion), then the PasswordProtect property will be set to 1. If the zip is strong encrypted, the Encryption property will be set to a value 1 through 4, where 4 indicates WinZip compatible AES encryption.

Returns 1 for success, 0 for failure.

Create Enveloping XML Digital Signature

Declare.i ckOpenZip(obj.i, zipPath.s)

Opens a Zip archive. Encrypted and password-protected zips may be opened without providing the password, but their contents may not be unzipped unless the correct password is provided via the DecryptPassword proprety, or the SetPassword method.

When a zip is opened, the PasswordProtect and Encryption properties will be appropriately set. If the zip is password protected (i.e. uses older Zip 2.0 encrypion), then the PasswordProtect property will be set to 1. If the zip is strong encrypted, the Encryption property will be set to a value 1 through 4, where 4 indicates WinZip compatible AES encryption.

Returns 1 for success, 0 for failure.

Declare.i ckOpenZipAsync(obj.i, zipPath.s)

Creates an asynchronous task to call the OpenZip method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns 0 on failure

How to Run an Asynchronous Task

Declare.i ckQuickAppend(obj.i, ZipFileName.s)

Efficiently appends additional files to an existing zip archive. QuickAppend leaves all entries in the existing .zip untouched. It operates by appending new files and updating the internal "central directory" of the zip archive.

Returns 1 for success, 0 for failure.

Append Files to Existing Zip w/out Rewriting Entire Zip

Declare.i ckQuickAppendAsync(obj.i, ZipFileName.s)

Creates an asynchronous task to call the QuickAppend method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns 0 on failure

How to Run an Asynchronous Task

Declare ckRemoveNoCompressExtension(obj.i, fileExtension.s)

Removes a file extension from the zip object's internal list of "no compress" extensions. (For more information, see AddNoCompressExtension.)

Declare.i ckSaveLastError(obj.i, path.s)

Saves the last-error information (the contents of LastErrorXml) to an XML formatted file.

Returns 1 for success, 0 for failure.

Declare ckSetCompressionLevel(obj.i, level.l)

Sets the compression level for all file and data entries. The compression level for a mapped entry (i.e. an entry that is contained within an opened .zip, cannot be changed.) The default compression level is 6. A compression level of 0 is equivalent to no compression. The maximum compression level is 9.

The zip.SetCompressionLevel method must be called after appending the files (i.e. after the calls to AppendFile*, AppendData, or AppendOneFileOrDir).

A single call to SetCompressionLevel will set the compression level for all existing file and data entries.

Declare ckSetExclusions(obj.i, excludePatterns.i)

Specify a collection of exclusion patterns to be used when adding files to a Zip. Each pattern in the collection can use the "*" wildcard character, where "*" indicates 0 or more occurrences of any character.

Declare ckSetPassword(obj.i, password.s)

Set the password for an encrypted or password-protected Zip.

Declare.i ckUnlockComponent(obj.i, regCode.s)

Unlocks the component allowing for the full functionality to be used. If a purchased unlock code is passed, there is no expiration. Any other string automatically begins a fully-functional 30-day trial the first time UnlockComponent is called.

Returns 1 for success, 0 for failure.

Diagnosing UnlockComponent Problems

UnlockComponent LastErrorText shows exact string passed to it.

Verify UnlockComponent Success w/ Purchased Unlock Code

LastErrorText Standard Information

Declare.i ckUnzip(obj.i, dirPath.s)

Unzips and returns the number of files unzipped, or -1 if a failure occurs. Subdirectories are automatically created during the unzipping process.

Declare.i ckUnzipAsync(obj.i, dirPath.s)

Creates an asynchronous task to call the Unzip method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns 0 on failure

How to Run an Asynchronous Task

Declare.i ckUnzipInto(obj.i, dirPath.s)

Unzips and returns the number of files unzipped, or -1 if a failure occurs. All files in the Zip are unzipped into the specfied dirPath regardless of the directory path information contained in the Zip. This has the effect of collapsing all files into a single directory. If several files in the Zip have the same name, the files unzipped last will overwrite the files already unzipped.

Declare.i ckUnzipIntoAsync(obj.i, dirPath.s)

Creates an asynchronous task to call the UnzipInto method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns 0 on failure

How to Run an Asynchronous Task

Declare.i ckUnzipMatching(obj.i, dirPath.s, pattern.s, verbose.l)

Same as Unzip, but only unzips files matching a pattern. If no wildcard characters ('*') are used, then only files that exactly match the pattern will be unzipped. The "*" characters matches 0 or more of any character.

Unzip Files Matching a Pattern (such as *.xml)

Declare.i ckUnzipMatchingAsync(obj.i, dirPath.s, pattern.s, verbose.l)

Creates an asynchronous task to call the UnzipMatching method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns 0 on failure

How to Run an Asynchronous Task

Declare.i ckUnzipMatchingInto(obj.i, dirPath.s, pattern.s, verbose.l)

Unzips matching files into a single directory, ignoring all path information stored in the Zip.

Declare.i ckUnzipMatchingIntoAsync(obj.i, dirPath.s, pattern.s, verbose.l)

Creates an asynchronous task to call the UnzipMatchingInto method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns 0 on failure

How to Run an Asynchronous Task

Declare.i ckUnzipNewer(obj.i, dirPath.s)

Same as Unzip, but only files that don't already exist on disk, or have later file modification dates are unzipped.

Declare.i ckUnzipNewerAsync(obj.i, dirPath.s)

Creates an asynchronous task to call the UnzipNewer method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns 0 on failure

How to Run an Asynchronous Task

Declare.i ckVerifyPassword(obj.i)

Tests the current DecryptPassword setting against the currently opened zip. Returns 1 if the password is valid, otherwise returns 0.

Verify a Zip's Password

Declare.i ckWriteBd(obj.i, binData.i)

Introduced in version 9.5.0.66

Same as WriteZip, but instead of writing the Zip to a file, it writes to binData. Zips that are written to binData can be opened by calling OpenBd. Note: Both WriteBd and OpenBd are added in Chilkat v9.5.0.66

Returns 1 for success, 0 for failure.

Declare.i ckWriteBdAsync(obj.i, binData.i)

Introduced in version 9.5.0.66

Creates an asynchronous task to call the WriteBd method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns 0 on failure

How to Run an Asynchronous Task

Declare.i ckWriteZip(obj.i)

Saves the Zip to a file and implictly re-opens it so further operations can continue. Use WriteZipAndClose to write and close the Zip. There is no limitation on the size of files that may be contained within a .zip, the total number of files in a .zip, or the total size of a .zip. If necessary, WriteZip will use the ZIP64 file format extensions when 4GB or file count limitations of the old zip file format are exceeded.

Returns 1 for success, 0 for failure.

Declare.i ckWriteZipAsync(obj.i)

Creates an asynchronous task to call the WriteZip method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns 0 on failure

How to Run an Asynchronous Task

Declare.i ckWriteZipAndClose(obj.i)

Saves the Zip to a file and closes it. On return, the Zip object will be in the state as if NewZip had been called. There is no limitation on the size of files that may be contained within a .zip, the total number of files in a .zip, or the total size of a .zip. If necessary, WriteZip will use the ZIP64 file format extensions when 4GB or file count limitations of the old zip file format are exceeded.

Returns 1 for success, 0 for failure.

Declare.i ckWriteZipAndCloseAsync(obj.i)

Creates an asynchronous task to call the WriteZipAndClose method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns 0 on failure

How to Run an Asynchronous Task