Skip to content

Zip (compress files)

ts
function Zip(what, zipArchive, password: string): boolean;

The Zip function creates a compressed (zip) archive with the files that are passed to it in the what argument (supports wildcards). If the destination zip archive already exists it will be overwritten and replaced.

This function accepts the following parameters:

ParameterTypeRequirementExplanation
whatstringrequiredmust be a valid and existing path or a wildcard path
zipArchivestringrequiredfully qualified path to the zip archive to be created
passwordstringoptionalif this is not empty the zip archive will be encrypted

Possible return values:

ValueExplanation
truethe function succeeded: the zip archive was created
truethe function failed: the zip archive was not created

Example

ts
{
  Zip('./documents/*.docx', './archives/dox.zip');
}