zip.list()

Type Function
Library zip.*
Return value none
Revision 2017.3060
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" )

-- Lists all files from "test.zip" with additional file info.

local function zipListener( event )

    if ( event.isError ) then
        print( "Error!" )
    else
        --example response
        --event.response = {
        --[1] =
        --{
        --   ratio: 98
        --   size: 2188295440
        --   file: space.jpg
        --},
        --[2] =
        --{
        --   ratio: 98
        --   size: 2188295440
        --   file: space1.jpg
        --}
    end
end

local zipOptions = {
    zipFile = "test.zip",
    zipBaseDir = system.DocumentsDirectory,
    listener = zipListener
}

zip.list( zipOptions )