Using JavaScript in HomeSite 4.0, Part III: The ZIPProvider Object's Properties
Using JavaScript in HomeSite 4.0, Part III
The ZIPProvider Object's Properties
The ZIPProvider
object is supported by Homesite for ZIP file composition and extraction. In this page we cover ZIPProvider's properties. We'll cover its methods in the next page.
ZIPFile |
Read-Write | String |
Sets/returns the archive file path against which following operations are applied. To add, delete or extract files from an existing archive file, set the property to the file path and call Add()
, Delete()
, or Extract()
methods on the file. To create a new archive file, set this property to the file path of the new file and then call the Add()
method to populate the file with content. The following example extracts a file (example.html
) from an archive file (d:\\yehuda\\column50.zip
) and saves it in a given directory (d:\\yehuda\\targetdir\\
):
function Main() {
var app = Application;
app.ZIPProvider.ExtractionDir = "d:\\yehuda\\targetdir\\";
app.ZIPProvider.ZipFile = "d:\\yehuda\\column50.zip";
var ReturnCode = app.ZIPProvider.Extract("example.html");
app.MessageBox("Return Code: " + ReturnCode, "ZIPProvider", 0);
}
ZIPComment |
Read-Write | String |
Sets/returns the comment for the archive file. You can use this property to read a comment of an existing archive file, or set the comment for a new archive file you create.
ExtractionDir |
Read-Write | String |
Sets/returns the directory path where the extracted files will be saved.
Overwrite |
Read-Write | Boolean |
Sets/returns whether the newly extracted file overwrites any existing file in the ExtractionDir directory.
Password |
Read-Write | String |
Sets/returns the password for the archive file. Set this property when extracting a password-protected file or if you want to password protect a new file you are about to create.
CompressionLevel |
Read-Write | Integer |
Sets/returns the compression level used in the archive file compression. Can be set to a value between 0 to 9, with 0 representing no compression, 1 the fastest compression, and 9 the slowest, but most size-efficient compression.
FileCount |
Read | Integer |
Returns the number of files in the archive.
Produced by Yehuda Shiran and Tomer Shiran
Created: October 11, 1999
Revised: October 15, 1999
URL: https://www.webreference.com/js/column50/zipprop1.html