qie.extractZipFile¶
Signature: qie.extractZipFile(zipFile, directory, overwriteExistingFiles*)
Returns: Boolean succeeded - true if the operation completes successfully
Extracts the contents of the zipFile to the specified directory.
Parameters¶
| Type | Name | Description | Default |
|---|---|---|---|
| String or File | zipFile | the new zip file to be extracted | |
| String or File | directory | the folder to extract the contents of the zipFile into |
|
| Boolean | overwriteExistingFiles* | (optional) true, to overwrite files that already exist in the directory |
false |
Example¶
// Extract Zip Files examples:
// Example: zipFile as String path, directory as String path
qie.writeFile("/tmp/letters/a.txt", "A is for apples.", true);
qie.writeFile("/tmp/letters/b.txt", "B is for baby.", true);
qie.createZipFile("/tmp/letters", "/tmp/letters.zip", true);
var success = qie.extractZipFile(
"/tmp/letters.zip",
"/tmp/the_letters", // this folder location must exist, no options exist to have it be auto-created
true
);
// Extracted files will now exist in /tmp/the_letters
// Example: zipFile as File, directory as File
var zipFileObject = qie.newFile("/tmp/letters.zip");
var directoryObject = qie.newFile("/tmp/the_letters_file");
var successWithFiles = qie.extractZipFile(
zipFileObject,
directoryObject, // this folder location must exist, no options exist to have it be auto-created
true
);
// Example: zipFile as String path, directory as File
var successWithStringZipFile = qie.extractZipFile(
"/tmp/letters.zip",
qie.newFile("/tmp/the_letters_mixed1"), // this folder location must exist, no options exist to have it be auto-created
true
);
// Example: zipFile as File, directory as String path
var successWithStringDirectory = qie.extractZipFile(
qie.newFile("/tmp/letters.zip"),
"/tmp/the_letters_mixed2", // this folder location must exist, no options exist to have it be auto-created
true
);