idx = zip.AddFile(id, f$[, table])
f$
to the zip archive specified by
id
and returns the index of the newly added file. The optional table
argument allows you to specify further options.
The following tags are currently recognized by the optional table argument:
NewName:
NewName
.
If NewName
is omitted, the file will always be stored in the root directory
of the zip archive.
Encryption:
#ZIP_EM_NONE:
#ZIP_EM_AES_128:
#ZIP_EM_AES_192:
#ZIP_EM_AES_256:
If you specify the Encryption
tag, it is also necessary to provide a
password that is needed to decrypt the file. You can specify this
password in the Password
tag (see below). If you don't use the Password
tag, the default password set using zip.SetDefaultPassword() is
used.
Password:
Encryption
tag has been set to a value different from #ZIP_EM_NONE
(see above), this tag can be set to a password that should be used to
protect the file. If you omit this tag, the default password set using
zip.SetDefaultPassword() is used.
Compression:
#ZIP_CM_DEFAULT:
#ZIP_CM_DEFLATE
.
#ZIP_CM_STORE:
#ZIP_CM_BZIP2:
#ZIP_CM_DEFLATE:
Note that only #ZIP_CM_DEFLATE
and #ZIP_CM_STORE
can be assumed to be universally
supported.
When specifying this tag, you can also pass the CompressionFlags
tag
to set the compression level (see below).
CompressionFlags:
Comment:
Time:
f$
. If you'd like to assign a different
datestamp to the file, then you need to pass a string in the standard Hollywood
date format of dd-mmm-yyyy hh:mm:ss
to this tag.
Encoding:
#ZIP_FL_ENC_UTF_8:
#ZIP_FL_ENC_CP437:
(V1.2)
Note that this function doesn't immediately begin compressing the file and
writing it to the zip archive. Instead, the file is just added into an
internal list and compressing and writing will be done once you call
zip.CloseArchive(). This means that you have to make sure that the
file you specified in f$
is still available when you call zip.CloseArchive(),
i.e. in case you pass the name of a temporary file to f$
you must not delete
this temporary file before you call zip.CloseArchive().