The @zip module contains functions and classes for manipulating Zip files and compressing data.

Functions

:shrink(data) #

Shrink (compress) aribtrary byte data.

Parameters

Return

:expand(data) #

Expand (uncompress) previously compressed data.

Parameters

Return

@writer Methods

:new(path) #

Create object for writing zip files.

Parameters

Return

:add(src,dst) #

Add file to zip.

Parameters

:add_folder(path,glob) #

Add entire folder to zip.

Parameters

Notes

If the folder path is "some/folder", the path within the zip will just be "folder".

@reader Methods

:new(path) #

Create object for reading zip files.

Parameters

Return

:items() #

Get the list of items within this zip.

Return

Notes

Each item is like:

{ name : string, exists : boolean, is_folder : boolean, modified : number (timestamp; seconds since Unix epoch), size : number (bytes) }

This is the same output format as os.dir(), except that the "exists" value should always be true.

Example

#print all files within zip z = zip.reader('test.zip') for item,z.items() print item.name :get_data(n) #

Get uncompressed data of file within zip.

Parameters

Return

:extract(n) #

Extract file to current directory.

Parameters

Notes

Subdirectories will be created in current directory as necessary.

:extract_all() #

Extract all files to current directory.

Notes

Subdirectories will be created in current directory as necessary.