Libraries
Zip Source Code
 previous   up   next 

Types
zipArchive
FileSys implementation type to access ZIP and JAR archives.

zipArchive

const type: zipArchive

FileSys implementation type to access ZIP and JAR archives. The ZIP format specification defines several compression methods. The ZIP file system supports the decompression of files compressed with store, shrink, deflate, deflate64, bzip2, LZMA, Zstandard and XZ. References to files in the archive are supported with the compression method 92. In accordance with the ISO/IEC 21320-1 standard files are only written with the methods store and deflate. The ZIP file system does not support the concept of a current working directory. The functions chdir and getcwd are not supported by the ZIP file system. The root path of a ZIP file system is "".


Function Summary
fileSys
openZip (inout file: zipFile)
Open a ZIP archive with the given zipFile.
fileSys
openZip (in string: zipFileName)
Open a ZIP archive with the given zipFileName.
void
close (inout zipArchive: zip)
Close a ZIP archive. The ZIP file below stays open.
array string
readDir (inout zipArchive: zip, in var string: dirPath)
Determine the file names in a directory inside a ZIP archive.
array string
readDir (inout zipArchive: zip, RECURSIVE)
Determine the file paths in a ZIP archive.
fileType
fileType (inout zipArchive: zip, in var string: filePath)
Determine the type of a file in a ZIP archive.
fileType
fileTypeSL (inout zipArchive: zip, in string: filePath)
Determine the type of a file in a ZIP archive.
fileMode
getFileMode (inout zipArchive: zip, in string: filePath)
Determine the file mode (permissions) of a file in a ZIP archive.
void
setFileMode (inout zipArchive: zip, in string: filePath, in fileMode: mode)
Change the file mode (permissions) of a file in an ZIP archive.
integer
fileSize (inout zipArchive: zip, in string: filePath)
Determine the size of a file in a ZIP archive.
time
getMTime (inout zipArchive: zip, in string: filePath)
Determine the modification time of a file in a ZIP archive.
void
setMTime (inout zipArchive: zip, in string: filePath, in time: modificationTime)
Set the modification time of a file in an ZIP archive.
string
getOwner (inout zipArchive: zip, in string: filePath)
Determine the name of the owner (UID) of a file in a ZIP archive.
void
setOwner (inout zipArchive: zip, in string: filePath, in string: owner)
Set the owner of a file in a ZIP archive.
string
getGroup (inout zipArchive: zip, in string: filePath)
Determine the name of the group (GID) of a file in a ZIP archive.
void
setGroup (inout zipArchive: zip, in string: filePath, in string: group)
Set the group of a file in a ZIP archive.
fileMode
getFileMode (inout zipArchive: zip, in string: filePath, SYMLINK)
Determine the file mode (permissions) of a symbolic link in a ZIP archive.
time
getMTime (inout zipArchive: zip, in string: filePath, SYMLINK)
Determine the modification time of a symbolic link in a ZIP archive.
void
setMTime (inout zipArchive: zip, in string: filePath, in time: modificationTime, SYMLINK)
Set the modification time of a symbolic link in a ZIP archive.
string
getOwner (inout zipArchive: zip, in string: filePath, SYMLINK)
Determine the name of the owner (UID) of a symbolic link in a ZIP archive.
void
setOwner (inout zipArchive: zip, in string: filePath, in string: owner, SYMLINK)
Set the owner of a symbolic link in a ZIP archive.
string
getGroup (inout zipArchive: zip, in string: filePath, SYMLINK)
Determine the name of the group (GID) of a symbolic link in a ZIP archive.
void
setGroup (inout zipArchive: zip, in string: filePath, in string: group, SYMLINK)
Set the group of a symbolic link in a ZIP archive.
string
readLink (inout zipArchive: zip, in string: filePath)
Reads the destination of a symbolic link in a ZIP archive.
void
makeLink (inout zipArchive: zip, in string: symlinkPath, in string: targetPath)
Create a symbolic link in a ZIP archive.
string
getFile (inout zipArchive: zip, in string: filePath)
Get the contents of a file in a ZIP archive.
void
putFile (inout zipArchive: zip, in string: filePath, in string: data)
Write data to a ZIP archive with the given filePath.
void
makeDir (inout zipArchive: zip, in string: dirPath)
Create a new directory in a ZIP archive.
void
removeFile (inout zipArchive: zip, in string: filePath)
Remove any file except non-empty directories from a ZIP archive.
void
for (inout string: filePath) range (inout zipArchive: zip) do (in proc: statements) end for
For-loop which loops recursively over the paths in a ZIP archive.

Function Detail

openZip

const func fileSys: openZip (inout file: zipFile)

Open a ZIP archive with the given zipFile.

Parameters:
zipFile - File that contains a ZIP archive.
Returns:
a file system that accesses the ZIP archive, or fileSys.value if it could not be opened.

openZip

const func fileSys: openZip (in string: zipFileName)

Open a ZIP archive with the given zipFileName.

Parameters:
zipFileName - Name of the ZIP archive to be opened.
Returns:
a file system that accesses the ZIP archive, or fileSys.value if it could not be opened.

close

const proc: close (inout zipArchive: zip)

Close a ZIP archive. The ZIP file below stays open.


readDir

const func array string: readDir (inout zipArchive: zip, in var string: dirPath)

Determine the file names in a directory inside a ZIP archive. Note that the function returns only the file names. Additional information must be obtained with other calls.

Parameters:
zip - Open ZIP archive.
dirPath - Path of a directory in the ZIP archive.
Returns:
an array with the file names.
Raises:
RANGE_ERROR - dirPath does not use the standard path representation.
FILE_ERROR - dirPath is not present in the ZIP archive.

readDir

const func array string: readDir (inout zipArchive: zip, RECURSIVE)

Determine the file paths in a ZIP archive. Note that the function returns only the file paths. Additional information must be obtained with other calls.

Parameters:
zip - Open ZIP archive.
Returns:
an array with the file paths.

fileType

const func fileType: fileType (inout zipArchive: zip, in var string: filePath)

Determine the type of a file in a ZIP archive. The function follows symbolic links. If the chain of symbolic links is too long the function returns FILE_SYMLINK. A return value of FILE_ABSENT does not imply that a file with this name can be created, since missing directories and invalid file names cause also FILE_ABSENT.

Returns:
the type of the file.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.

fileTypeSL

const func fileType: fileTypeSL (inout zipArchive: zip, in string: filePath)

Determine the type of a file in a ZIP archive. A return value of FILE_ABSENT does not imply that a file with this name can be created, since missing directories and invalid file names cause also FILE_ABSENT.

Returns:
the type of the file.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.

getFileMode

const func fileMode: getFileMode (inout zipArchive: zip, in string: filePath)

Determine the file mode (permissions) of a file in a ZIP archive. The function follows symbolic links.

Returns:
the file mode.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - filePath is not present in the ZIP archive.

setFileMode

const proc: setFileMode (inout zipArchive: zip, in string: filePath, in fileMode: mode)

Change the file mode (permissions) of a file in an ZIP archive. The function follows symbolic links.

Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - filePath is not present in the ZIP archive.

fileSize

const func integer: fileSize (inout zipArchive: zip, in string: filePath)

Determine the size of a file in a ZIP archive. The file size is measured in bytes. For directories a size of 0 is returned. The function follows symbolic links.

Returns:
the size of the file.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - filePath is not present in the ZIP archive.

getMTime

const func time: getMTime (inout zipArchive: zip, in string: filePath)

Determine the modification time of a file in a ZIP archive. The function follows symbolic links.

Returns:
the modification time of the file.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - filePath is not present in the ZIP archive.

setMTime

const proc: setMTime (inout zipArchive: zip, in string: filePath, in time: modificationTime)

Set the modification time of a file in an ZIP archive. The function follows symbolic links.

Raises:
RANGE_ERROR - filePath does not use the standard path representation.
RANGE_ERROR - aTime is invalid or cannot be converted to the system file time.
FILE_ERROR - filePath is not present in the ZIP archive.

getOwner

const func string: getOwner (inout zipArchive: zip, in string: filePath)

Determine the name of the owner (UID) of a file in a ZIP archive. The function follows symbolic links.

Returns:
the name of the file owner.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - filePath is not present in the ZIP archive, or the chain of symbolic links is too long.

setOwner

const proc: setOwner (inout zipArchive: zip, in string: filePath, in string: owner)

Set the owner of a file in a ZIP archive. The function follows symbolic links. The ZIP archive format allows only a numeric UID. The owner "root" is mapped to the UID 0. Other owner names raise a RANGE_ERROR.

Raises:
RANGE_ERROR - filePath does not use the standard path representation, or the owner cannot be mapped to a UID.
FILE_ERROR - filePath is not present in the ZIP archive, or the chain of symbolic links is too long.

getGroup

const func string: getGroup (inout zipArchive: zip, in string: filePath)

Determine the name of the group (GID) of a file in a ZIP archive. The function follows symbolic links.

Returns:
the name of the file group.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - filePath is not present in the ZIP archive, or the chain of symbolic links is too long.

setGroup

const proc: setGroup (inout zipArchive: zip, in string: filePath, in string: group)

Set the group of a file in a ZIP archive. The function follows symbolic links. The ZIP archive format allows only a numeric GID. The group "root" is mapped to the GID 0. Other group names raise a RANGE_ERROR.

Raises:
RANGE_ERROR - filePath does not use the standard path representation, or the group cannot be mapped to a GID.
FILE_ERROR - filePath is not present in the ZIP archive, or the chain of symbolic links is too long.

getFileMode

const func fileMode: getFileMode (inout zipArchive: zip, in string: filePath, SYMLINK)

Determine the file mode (permissions) of a symbolic link in a ZIP archive. The function only works for symbolic links and does not follow the symbolic link.

Returns:
the file mode.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - The file described with filePath is not present in the ZIP archive, or it is not a symbolic link.

getMTime

const func time: getMTime (inout zipArchive: zip, in string: filePath, SYMLINK)

Determine the modification time of a symbolic link in a ZIP archive. The function only works for symbolic links and does not follow the symbolic link.

Returns:
the modification time of the symbolic link.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - The file described with filePath is not present in the ZIP archive, or it is not a symbolic link.

setMTime

const proc: setMTime (inout zipArchive: zip, in string: filePath, in time: modificationTime, SYMLINK)

Set the modification time of a symbolic link in a ZIP archive. The function only works for symbolic links and does not follow the symbolic link.

Raises:
RANGE_ERROR - filePath does not use the standard path representation.
RANGE_ERROR - modificationTime is invalid or it cannot be converted to the system file time.
FILE_ERROR - The file described with filePath is not present in the ZIP archive, or it is not a symbolic link.

getOwner

const func string: getOwner (inout zipArchive: zip, in string: filePath, SYMLINK)

Determine the name of the owner (UID) of a symbolic link in a ZIP archive. The function only works for symbolic links and does not follow the symbolic link.

Returns:
the name of the file owner.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - The file described with filePath is not present in the ZIP archive, or it is not a symbolic link.

setOwner

const proc: setOwner (inout zipArchive: zip, in string: filePath, in string: owner, SYMLINK)

Set the owner of a symbolic link in a ZIP archive. The function only works for symbolic links and does not follow the symbolic link. The ZIP archive format allows only a numeric UID. The owner "root" is mapped to the UID 0. Other owner names raise a RANGE_ERROR.

Raises:
RANGE_ERROR - filePath does not use the standard path representation, or the owner cannot be mapped to a UID.
FILE_ERROR - The file described with filePath is not present in the ZIP archive, or it is not a symbolic link.

getGroup

const func string: getGroup (inout zipArchive: zip, in string: filePath, SYMLINK)

Determine the name of the group (GID) of a symbolic link in a ZIP archive. The function only works for symbolic links and does not follow the symbolic link.

Returns:
the name of the file group.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - The file described with filePath is not present in the ZIP archive, or it is not a symbolic link.

setGroup

const proc: setGroup (inout zipArchive: zip, in string: filePath, in string: group, SYMLINK)

Set the group of a symbolic link in a ZIP archive. The function only works for symbolic links and does not follow the symbolic link. The ZIP archive format allows only a numeric GID. The group "root" is mapped to the GID 0. Other group names raise a RANGE_ERROR.

Raises:
RANGE_ERROR - filePath does not use the standard path representation, or the group cannot be mapped to a GID.
FILE_ERROR - The file described with filePath is not present in the ZIP archive, or it is not a symbolic link.

readLink

const func string: readLink (inout zipArchive: zip, in string: filePath)

Reads the destination of a symbolic link in a ZIP archive.

Returns:
The destination referred by the symbolic link.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - filePath is not present in the ZIP archive, or is not a symbolic link.

makeLink

const proc: makeLink (inout zipArchive: zip, in string: symlinkPath, in string: targetPath)

Create a symbolic link in a ZIP archive. The symbolic link symlinkPath will refer to targetPath afterwards. The function does not follow symbolic links.

Parameters:
zip - Open ZIP archive.
symlinkPath - Name of the symbolic link to be created.
targetPath - String to be contained in the symbolic link.
Raises:
RANGE_ERROR - targetPath or symlinkPath does not use the standard path representation.
FILE_ERROR - A system function returns an error.

getFile

const func string: getFile (inout zipArchive: zip, in string: filePath)

Get the contents of a file in a ZIP archive. The function follows symbolic links.

Returns:
the specified file as string.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - filePath is not present in the ZIP archive, or the crc-32 checksum is not okay.

putFile

const proc: putFile (inout zipArchive: zip, in string: filePath, in string: data)

Write data to a ZIP archive with the given filePath. If the file exists already, it is overwritten.

Raises:
RANGE_ERROR - filePath does not use the standard path representation.

makeDir

const proc: makeDir (inout zipArchive: zip, in string: dirPath)

Create a new directory in a ZIP archive. The function does not follow symbolic links.

Parameters:
zip - Open ZIP archive.
dirPath - Name of the directory to be created.
Raises:
RANGE_ERROR - dirPath does not use the standard path representation.
FILE_ERROR - The file dirPath already exists.

removeFile

const proc: removeFile (inout zipArchive: zip, in string: filePath)

Remove any file except non-empty directories from a ZIP archive. The function does not follow symbolic links. An attempt to remove a directory that is not empty triggers FILE_ERROR.

Parameters:
zip - Open ZIP archive.
filePath - Name of the file to be removed.
Raises:
RANGE_ERROR - filePath does not use the standard path representation.
FILE_ERROR - The file does not exist or it is a directory that is not empty.

for

const proc: for (inout string: filePath) range (inout zipArchive: zip) do (in proc: statements) end for

For-loop which loops recursively over the paths in a ZIP archive.



 previous   up   next