This [[Module Library|XQuery Module]] contains functions to handle ZIP archives. New ZIP and GZIP archives can be created, existing archives can be updated, and the archive entries can be listed and extracted. This module may soon replace the existing [[ZIP Module]] ([http://spex.basex.org/index.php?title=ZIP_Module more information]).
=Conventions=
|-
| '''Summary'''
|Creates a new ZIP archive from the specified entries and contents.<br/>The {{Code|$entries}} argument contains meta information required to create new ZIP entries. All items may either be of type {{Code|xs:string}}, representing the entry name, or {{Code|element(archive:entry)}}, containing the name as text node and additional, optional attributes:
* {{Code|last-modified}}: timestamp, specified as xs:dateTime (default: current time)
* {{Code|compression-level}}: 0-9, 0 = uncompressed (default: 8)
|-
| width='90' | '''Signatures'''
|{{Func|archive:entries|$zip archive as xs:base64Binary|element(archive:entry)*}}<br />
|-
| '''Summary'''
|Returns the entry descriptors of the given zip archive. A descriptor contains the following attributes, provided that they are available in the archive format:
* {{Code|size}}: original file size
* {{Code|last-modified}}: timestamp, formatted as xs:dateTime
|-
| width='90' | '''Signatures'''
|{{Func|archive:options|$zip archive as xs:base64Binary|element(archive:options)}}<br />
|-
| '''Summary'''
|Returns the options of the given zip archive in the format specified by [[#archive:create|archive:create]].
|-
| '''Errors'''
|-
| width='90' | '''Signatures'''
|{{Func|archive:extract-text|$zip archive as xs:base64Binary|xs:string*}}<br/>{{Func|archive:extract-text|$zip archive as xs:base64Binary, $entries as item()*|xs:string*}}<br/>{{Func|archive:extract-text|$zip archive as xs:base64Binary, $entries as item()*, $encoding as xs:string|xs:string*}}<br/>
|-
| '''Summary'''
|-
| width='90' | '''Signatures'''
|{{Func|archive:extract-binary|$zip archive as xs:base64Binary|xs:string*}}<br/>{{Func|archive:extract-binary|$zip archive as xs:base64Binary, $entries as item()*|xs:base64Binary*}}
|-
| '''Summary'''
|-
| width='90' | '''Signatures'''
|{{Func|archive:update|$zip archive as xs:base64Binary, $entries as item()*, $contents as item()*|xs:base64Binary}}
|-
| '''Summary'''
|Adds new entries and replaces existing entries in a zip an archive.<br/>The format of {{Code|$entries}} and {{Code|$contents}} is the same as for [[#archive:create|archive:create]].
|-
| '''Errors'''
|-
| width='90' | '''Signatures'''
|{{Func|archive:delete|$zip archive as xs:base64Binary, $entries as item()*|xs:base64Binary}}
|-
| '''Summary'''
|Deletes entries from a zip an archive.<br/>The format of {{Code|$entries}} is the same as for [[#archive:create|archive:create]].
|-
| '''Errors'''
|-
|{{Code|ARCH9999}}
|ZIP Archive processing failed for some other reason.
|}