Skip to content

UnZip

Extracts the files inside an archive file into the database and returns an array containing file information.

1
myFiles.UnZip(id: string, separator: string):Array<FileInfo>

Parameters

string id
    The ID of the archive file.

string separator
    The directory separator. Optional. The default value is "\".

Returns

An array of FileInfo objects representing the extracted files.

Remarks

This function is used to extract the contents of an archive file.
It saves the extracted files individually into the database.

Usage:

1
2
3
4
5
6
7
8
9
var unzippedFiles = $Files.UnZip(zipFile.Id);
unzippedFiles.forEach(function(file) {
    var fileContent = $Files.GetString(file.Id);
    // do sth with the file content
});

// It would be a good practice to delete the archive file when you are finished using it
// since the files in it are also saved by calling the UnZip method
$Files.Delete(zipFile.Id);

See Also