Skip to content

Instantly share code, notes, and snippets.

@peter-mach
Created April 26, 2015 15:23
Show Gist options
  • Save peter-mach/e06573aee47813957a93 to your computer and use it in GitHub Desktop.
Save peter-mach/e06573aee47813957a93 to your computer and use it in GitHub Desktop.
Unzipping the compressed folder with CoronaSDK zip plugin
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