Zip Bean
Properties Methods Events Configuration Settings Errors
The Zip component implements a PKZip-compatible Zip compressor and decompressor.
Syntax
IPWorksZip.Zip
Remarks
The bean uses the Deflate algorithm specified in RFC 1951 for compression, and produces and reads output compatible with PKZip, WinZip, etc.
To create a new archive, first set the ArchiveFile property to the name of the archive to be created. Then, specify the files to be compressed either by invoking IncludeFiles, or by adding a new object to the Files collection and setting the values of the DecompressedName and CompressedName. fields. Finally, call the Compress method to create the archive.
To decompress an existing archive, set ArchiveFile to the name of the archive to be decompressed. The ExtractToPath property may be set, and then calling the ExtractAll method will decompress all files in the archive to this path.
For finer control, the Scan method should be used to read the file information stored in the archive. This will fill out the information in the Files collection. The values of DecompressedName may then be changed if desired. Finally, ExtractAll may be used to decompress the entire archive, or Extract may be used for finer control.
Data may be streamed out by setting WriteToProgressEvent to true. Then, the Progress event may be trapped to retrieve the data.
Example (Creating an Archive)
ZipControl.ArchiveFile =
"c:\test.zip"
ZipControl.RecurseSubdirectories =
true
ZipControl.IncludeFiles(
"c:\foo\*"
)
ZipControl.Compress()
Example (Extracting from an Archive)
ZipControl.ArchiveFile =
"c:\temp.zip"
ZipControl.ExtractToPath =
"c:\extracted\"
ZipControl.ExtractAll()
Property List
The following is the full list of the properties of the bean with short descriptions. Click on the links for further details.
ArchiveFile | The name of the zip, gzip, tar, or jar archive. |
CompressionLevel | The compression level to use. |
EncryptionAlgorithm | The algorithm used to encrypt files written to the archive. |
ExcludedFiles | A list of files to exclude. |
ExtractToPath | A base path to decompress to. |
Files | Collection of Zip archive files. |
OverwriteFiles | Whether or not to overwrite files. |
Password | A password for the zip archive. |
RecurseSubdirectories | Whether or not to recurse into subdirectories. |
ZipComment | The comment for the entire zip file. |
ZipData | (Decompression only) The zip file contents as a byte array. |
Method List
The following is the full list of the methods of the bean with short descriptions. Click on the links for further details.
abort | Aborts the current operation. |
appendFiles | Adds specified files to an existing archive. |
compress | Creates the compressed archive. |
config | Sets or retrieves a configuration setting . |
delete | Deletes one or more files from an existing archive. |
extract | Extracts a single file, directory, or group of files, from the archive. |
extractAll | Extracts all files from the compressed archive. |
includeFiles | Specifies that the indicated files should be added to the archive. |
reset | Resets the component. |
scan | Scans the compressed archive. |
setArchiveInputStream | The stream to read the zip, tar, jar, or gzip archive from. |
setArchiveOutputStream | The stream to write the zip, tar, jar, or gzip archive to. |
update | Will update certain files in an archive. |
Event List
The following is the full list of the events fired by the bean with short descriptions. Click on the links for further details.
BeginFile | Fired before each file is processed. |
EndFile | Fired after each file is processed. |
Error | Information about non-fatal errors. |
Overwrite | Fired whenever a file exists and may be overwritten. |
Password | Fired when a file is encrypted, and the file's password is incorrect. |
Progress | Fired as progress is made. |
Configuration Settings
The following is a list of configuration settings for the bean with short descriptions. Click on the links for further details.
AESGenerateUniqueKeys | Whether to generate unique keys for each file encrypted. |
EnableStreamingEncryption | Whether to allow streaming and encryption simultaneously. |
FileHashAlgorithm | The algorithm used to generate a hash of each file during compression. |
Files[i].FileHash | The hash generated for each file during compression. |
ForceZip64Format | Whether to explicitly compress a Zip64 format archive. |
MarkAsText | Whether to mark files as text files. |
PreserveModifiedTime | Whether or not to preserve the original modified time on extracted files. |
RecalculateCRC | Whether to recalculate the CRC. |
WriteToProgressEvent | Whether or not to write data to the Progress Event. |
CompressionMethod | Used to set the method of compression. |
ExcludedAttributes | Attributes of files to be excluded. |
ExtractFilesOnly | Whether to only extract the files contained within the archive. |
OverwriteReadonlyFiles | Whether to overwrite readonly files. |
CodePage | The system code page used for Unicode to Multibyte translations. |