Name
zip.OpenArchive -- open a zip archive for reading or writing
Synopsis
[id] = zip.OpenArchive(id, filename$[, mode, t])
Function
This function attempts to open the zip archive specified by filename$ and assigns id to it. If you pass Nil in id, zip.OpenArchive() will automatically choose a vacant identifier and return it. If the file does not exist, this function will fail unless you use the mode argument to open a zip archive for writing. In that case, zip.OpenArchive() will create the file for you.

The following modes are currently supported:

#MODE_READ:
Open the zip archive for reading. This is the default mode.

#MODE_READWRITE:
Open the zip archive for reading and writing. If the specified zip archive doesn't exist, it is automatically created.

#MODE_WRITE:
Open the zip archive for writing. If the specified zip archive already exists, it will be overwritten.

The optional table argument t can be used to specify additional parameters. The following tags are accepted here:

NoTmp:
By default, zip.OpenArchive() will create a temporary file when using #MODE_WRITE or #MODE_READWRITE. If you don't want that, set this tag to True and everything will be done in memory. Only set this to True if your system has sufficient memory. Defaults to False. (V2.1)

Although zip.hwp will automatically close all open zip archives when it quits, it is strongly advised that you close an open zip archive when you are done with it using the zip.CloseArchive() function because otherwise you are wasting resources and in case you are writing or modifying a zip archive, zip.CloseArchive() is where the actual work is done.

Note that zip.OpenArchive() will create a standard Hollywood object which can also be used with functions from Hollywood's object library such as GetAttribute(), SetObjectData(), GetObjectData(), etc. See zip.GetObjectType for details.

Inputs
id
identifier of the file or Nil for auto id selection
filename$
name of the file to open
mode
mode to open the file; can be #MODE_READ, #MODE_WRITE or #MODE_READWRITE (defaults to #MODE_READ)
t
optional: table argument containing further options (see above) (V2.1)
Results
id
optional: identifier of the file; will only be returned when you pass Nil as argument 1 (see above)

Show TOC