zip.list()

Type Function
Library zip.*
Return value none
Revision Release 2022.3683
Keywords zip, list
See also zip.compress()
zip.uncompress()

Overview

Lists all files in a zip archive.

Syntax

zip.list( options )
options (required)

Table. A table of options for the function call — see the next section for details.

Options Reference

zipFile (required)

String. The filename of the zip archive.

zipBaseDir (required)

Constant. The base directory containing the zip archive.

listener (required)

Listener. The listener function invoked at the end of the operation.

Example

local zip = require( "plugin.zip" )

local function zipListener( event )

    if ( event.isError ) then
        print( "Error!" )
    else
        print ( event["type"] )  --> list
        print( event.response )
        --> [1] = table: 0x618001466580 {
        -->     ratio: 98
        -->     size: 2188295440
        -->     file: space.jpg
        --> [2] = table: 0x618001466580 {
        -->     ratio: 98
        -->     size: 2188295440
        -->     file: space1.jpg
    end
end

-- List all files from "test.zip" with additional file info
local zipOptions = {
    zipFile = "test.zip",
    zipBaseDir = system.DocumentsDirectory,
    listener = zipListener
}

zip.list( zipOptions )