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

Returns:

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

Type: `Array.<Object>`

##### Example

    [
         {name:string, is_directory:bool, size:number, crc32:number},
         ...
    ]

#### # NumEntries() → {number}

get number of entries in ZIP.

Returns:

number of entries in this ZIP.

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

Returns:

the content of the file as array of numbers.

Type: `Array.<number>`

#### # ReadInts(zip_name) → {ByteArray}

get file contents as ByteArray.

##### Parameters:

Name | Type | Description
--- | --- | ---
`zip_name` | `string` | the full path of the file in the ZIP.

Returns:

the content of the file as ByteArray.

Type: `ByteArray`

#### # 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` | `ByteArray` | the data to write as ByteArray (must be integers between 0-255).