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

@zip 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

:len() #

Get the number of files within this zip.

Return

Example

#print all files within zip z = zip.reader('test.zip') for n,z.len() print z.get_name(n) :get_name(n) #

Get name (path) of file within zip.

Parameters

Return

: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.