ZipCreateBuffer

This function is used to create a new empty zip file in memory, use ZipAddBuffer or ZipAddFile to add files to the zip archive.

OutputVar := ZipCreateBuffer(MaxSize , Password)
Function Example: hZip := ZipCreateBuffer(10000000)

Parameters

OutputVar

The name of the variable in which to store the zip handle that can be used in ZipAddBuffer, ZipAddFile and ZipCloseBuffer.

MaxSize

Maximum size for zip archive in memory, you can make this a very large number because memory will be only reserved, but not actually committed, until needed.

Password (optional)

The password to use for the zip file.

Remarks

Use ZipCreateBuffer to create a new zip file, then use ZipAddFile or ZipAddBuffer to add files to it and finally use ZipCloseBuffer to close the file.
You cannot add files to existing zip file or after ZipCloseBuffer has been called, instead UnZip all files and create a new zip file.
A_ZipCompressionLevel can be used to change compression level. Use 0 for lowest and 9 for highest compression.

Related

ZipCreateFile, ZipAddFile, ZipCloseFile, ZipOptions, UnZip, ZipAddBuffer, ZipCloseBuffer, UnZipBuffer, ZipRawMemory, UnZipRawMemory, ZipInfo, ZipAddFolder

Examples

hZip:=ZipCreateBuffer(10000000)
ZipAddFile(hZip, "C:\MyScript.ahk")
sz := ZipCloseBuffer(hZip, var)