-
-
Save nadar71/353b140d937c93341f77eade03b4289c to your computer and use it in GitHub Desktop.
Unzipping the compressed folder with CoronaSDK zip plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local zip = require 'plugin.zip' | |
local zipFileName = 'zippedFolder.zip' | |
local function unzipListener( event ) | |
print('unzipping complete') | |
end | |
local unzipOptions = { | |
zipFile = event.response.fileName, | |
zipBaseDir = system.TemporaryDirectory, | |
dstBaseDir = system.DocumentsDirectory, | |
files = {}, | |
listener = unzipListener | |
} | |
local function listZipListener( event ) | |
local fileList = {} | |
for i,v in ipairs(event.response) do | |
fileList[#fileList+1] = v.file | |
end | |
unzipOptions.files = fileList | |
print('zip listing complete') | |
zip.uncompress( unzipOptions ) | |
end | |
local listZipOptions = { | |
zipFile = zipFileName, | |
zipBaseDir = system.TemporaryDirectory, | |
listener = listZipListener | |
} | |
zip.list( listZipOptions ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment