◷ Reading Time: 2 minutes
FlexRule.Extensions.Compression
This extension enables compression capability for files and folders.
pack
Creates a package file containing all files within a folder
pack (type, source, target)
- type: zip, tgz, gz
- source: source folder (zip, tgz) or file (gz) to create the package
- target: target full file path to be created
- Return: the created target package file
Example 1: Packaging a folder to a zip file pack('zip', 'd:\\sources\\samples', 'd:\\backup\\source-sample.zip')
unpack
Creates a folder and extract a package file
unpack (type, source, target)
- type: zip, tgz, gz
- source: source file to be extracted
- target: target folder (zip, tgz) or file (gz) to store the extracted file(s). GZ is only for a single file.
- Return: the created target folder (zip, tgz) or file (gz)
Example 1: Unpacking a GZ file unpack('gz', 'd:\\temp\\myfile.csv.gz', 'd:\\temp\\myfile.csv')
Example 2: Unpacking a ZIP file unpack('zip', 'd:\\temp\\archive1.zip', 'd:\\archive1')