ZIPArchive
A 4D ZIP archive is a File
or Folder
object containing one or more files or folders, which are compressed to be smaller than their original size. These archives are created with a ".zip" extension and can be used to save disk space or transfer files via mediums which may have size limitations (e.g., email or network).
- You create a 4D ZIP archive with the
ZIP Create archive
command. - 4D
ZIPFile
andZIPFolder
instances are available through theroot
property (ZIPFolder
) of the object returned byZIP Read archive
command.
Example
To retrieve and view the contents of a ZIP file object:
var $path; $archive : 4D.File
var $zipFile : 4D.ZipFile
var $zipFolder : 4D.ZipFolder
var $txt : Text
$path:=Folder(fk desktop folder).file("MyDocs/Archive.zip")
$archive:=ZIP Read archive($path)
$zipFolder:=$archive.root // store the zip main folder
$zipFile:=$zipFolder.files()[0] //read the first zipped file
If($zipFile.extension=".txt")
$txt:=$zipFile.getText()
End if
Summary
.root : 4D.ZipFolder a virtual folder providing access to the contents of the ZIP archive |
.root
.root : 4D.ZipFolder
Description
The .root
property contains a virtual folder providing access to the contents of the ZIP archive.
The root
folder and its contents can be manipulated with the ZipFile and ZipFolder functions and properties.
This property is read-only.