# 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 |
FILE | 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. |
# 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:
Example
[
{name:string, is_directory:bool, size:number, crc32: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.
# 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.
# 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). |