Class

Zip

Zip(filename, mode, compressionopt)

Constructor

# new Zip(filename, mode, compressionopt)

Open a ZIP, for file modes see ZIPFILE.

Parameters:
Name Type Attributes Description
filename string

the name of the file.

mode ZIPFILE

READ, WRITE or APPEND.

compression number <optional>

1..9 to specify compression level.

Methods

# AddFile(zip_name, hdd_name)

add a file to a ZIP.

Parameters:
Name Type Description
zip_name string

the full path the file shall have in the ZIP.

hdd_name string

the full path to the file to add.

# Close()

close ZIP.

# DeleteFile(zip_name)

remove file from ZIP.

Parameters:
Name Type Description
zip_name string

the full path of the file to remove from ZIP.

# ExtractFile(zip_name, hdd_name)

extract a file from a ZIP.

Parameters:
Name Type Description
zip_name string

the full path of the file in the ZIP.

hdd_name string

the full path the extracted file should have on the HDD.

# GetEntries() → {Array.<Object>}

get an array with the file entries in the ZIP.

an array containing the file entries of the ZIP in the following format:

Array.<Object>
Example
[
     {name:string, is_directory:bool, size:number, crc32:number},
     ...
]

# NumEntries() → {number}

get number of entries in ZIP.

number of entries in this ZIP.

number

# ReadBytes(zip_name) → {Array.<number>}

get file contents as number array.

Parameters:
Name Type Description
zip_name string

the full path of the file in the ZIP.

the content of the file as array of numbers.

Array.<number>

# ReadInts(zip_name) → {IntArray}

get file contents as IntArray.

Parameters:
Name Type Description
zip_name string

the full path of the file in the ZIP.

the content of the file as IntArray.

IntArray

# WriteBytes(zip_name, data)

Write a bytes to a file in the ZIP.

Parameters:
Name Type Description
zip_name string

the full path of the file in the ZIP.

data Array.<number>

the data to write as array of numbers (must be integers between 0-255).

# WriteInts(zip_name, data)

Write a bytes to a file in the ZIP.

Parameters:
Name Type Description
zip_name string

the full path of the file in the ZIP.

data IntArray

the data to write as IntArray (must be integers between 0-255).