Type Function Library zip.* Return value none Revision 2017.3060 Keywords zip, compress See also zip.uncompress()
Creates or adds files to a zip archive.
zip.compress( options )
Table. A table of options for the function call — see the next section for details.
String. The zip file to compress files to.
Constant. The base directory containing the zip archive.
Constant. The base directory containing the files to add to the zip archive.
Array. A table specifying a set of file names to compress into the archive.
Listener. The listener function invoked at the end of the operation.
local zip = require( "plugin.zip" ) -- Attempts to compress files in the "filenames" parameter to "test.zip". local function zipListener( event ) if ( event.isError ) then print( "Error!" ) else print ( "event.name: " .. event.name ) print ( "event.type: " .. event.type ) --example response --event.response = { --[1] = "space.jpg", --[2] = "space1.jpg", --} end end local zipOptions = { zipFile = "test.zip", zipBaseDir = system.DocumentsDirectory, srcBaseDir = system.ResourceDirectory, srcFiles = { "space.jpg", "space1.jpg", "space2.jpg" }, listener = zipListener } zip.compress( zipOptions )