-
-
Notifications
You must be signed in to change notification settings - Fork 3
PKZip.WriteZip
PKZip.WriteZip
Protected Function WriteZip(ToArchive() As FolderItem, OutputStream As BinaryStream, RelativeRoot As FolderItem, CompressionLevel As Integer = 6, CompressionMethod As Integer = -1) As Boolean
Protected Function WriteZip(ToArchive() As FolderItem, OutputFile As FolderItem, RelativeRoot As FolderItem, Overwrite As Boolean = False, CompressionLevel As Integer = 6, CompressionMethod As Integer = -1) As Boolean
Protected Function WriteZip(ToArchive As FolderItem, OutputStream As BinaryStream, CompressionLevel As Integer = 6, CompressionMethod As Integer = -1) As Boolean
Protected Function WriteZip(ToArchive As FolderItem, OutputFile As FolderItem, Overwrite As Boolean = False, CompressionLevel As Integer = 6, CompressionMethod As Integer = -1) As Boolean
Name | Type | Comment |
---|---|---|
ToArchive | FolderItem array | A list of files and folders to be archived. |
OutputStream | BinaryStream | The archive stream. |
RelativeRoot | FolderItem | Optional. The root of the directory structure to recreate in the archive. |
CompressionLevel | Integer | Optional. A number between 1 and 9 controlling how aggressive the compression should be (or 0 for no compression). |
CompressionMethod | Integer | Optional. The type of compression (deflate, bzip2, none, etc.) to use. If not specified then deflate will be used if it is available. |
Name | Type | Comment |
---|---|---|
ToArchive | FolderItem array | A list of files and folders to be archived. |
OutputFile | FolderItem | The archive file. |
RelativeRoot | FolderItem | Optional. The root of the directory structure to recreate in the archive. |
Overwrite | Boolean | Optional. If True then the OutputFile is overwritten if it exists. |
CompressionLevel | Integer | Optional. A number between 1 and 9 controlling how aggressive the compression should be (or 0 for no compression). |
CompressionMethod | Integer | Optional. The type of compression (deflate, bzip2, none, etc.) to use. If not specified then deflate will be used if it is available. |
Name | Type | Comment |
---|---|---|
ToArchive | FolderItem | The directory to be recursively archived. |
OutputStream | BinaryStream | The archive stream. |
CompressionLevel | Integer | Optional. A number between 1 and 9 controlling how aggressive the compression should be (or 0 for no compression). |
CompressionMethod | Integer | Optional. The type of compression (deflate, bzip2, none, etc.) to use. If not specified then deflate will be used if it is available. |
Name | Type | Comment |
---|---|---|
ToArchive | FolderItem | The directory to be recursively archived. |
OutputFile | FolderItem | The archive file. |
Overwrite | Boolean | Optional. If True then the OutputFile is overwritten if it exists. |
CompressionLevel | Integer | Optional. A number between 1 and 9 controlling how aggressive the compression should be (or 0 for no compression). |
CompressionMethod | Integer | Optional. The type of compression (deflate, bzip2, none, etc.) to use. If not specified then deflate will be used if it is available. |
Returns True
if the operation was successful.
Creates a Zip archive in the OutputFile
or OutputStream
containing the files specified by ToArchive
.
If the ToArchive
parameter is a FolderItem representing a directory then that directory is recursively archived.
If the ToArchive
parameter is an array of FolderItems then those items are added to the archive. If RelativeRoot
is specified then it is used to generate relative paths for items in the ToArchive
array; if no relative root is specified then all the items are stored in the root of the archive.
This example creates a new zip archive by recursively compressing a directory structure:
Dim zipfile As FolderItem = GetSaveFolderItem("", "output.zip") ' the zip file
Dim target As FolderItem = SelectFolder() ' the target folder
If Not PKZip.WriteZip(target, zipfile) Then MsgBox("Zip error!")
Wiki home | Project page | Bugs | Become a sponsor
Text and code examples are Copyright ©2014-24 Andrew Lambert, offered under the CC BY-SA 3.0 License.