ModZipReader
See the code atutils/zip_reader.gdDescription
Inherits ZIPReader
This class is an extension of the native Godot ZIPReader. It handles reading files and resources from inside ZIPs.
Signals
None
Properties
None
Methods
read
static func read(path: String, callback: Callable) -> unknown:
Opens a ZIP file and handles the contents.
Note: This is a static function and should be called directly on ModZipReader.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | The path to the ZIP to open. |
callback | CallableShould accept two arguments:
| After opening the ZIP, this function will be called with arguments:
|
Returns
| Type | unknown |
|---|---|
| Default | void |
| Description | Will return the result of the callback function. |
exists
func exists(path: String) -> bool
Checks if a file exists at the given path inside the opened ZIP.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | The path to check. |
Returns
| Type | bool |
|---|---|
| Description | true if there is a non-empty file at the given path. |
read_string
func read_string(path: String) -> String
Reads the contents of the file at the given path as a String.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | The path to read from. |
Returns
| Type | String |
|---|---|
| Description | The contents of the file. |
read_resource
func read_resource(path: String) -> Resource
Reads the contents of the file at the given path as a Resource.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | The path to read from. |
Returns
| Type | Resource |
|---|---|
| Description | The resource at the given path. |
read_script
func read_script(path: String) -> GDScript
Reads the contents of the file at the given path as a GDScript.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | The path to read from. |
Returns
| Type | GDScript |
|---|---|
| Description | The script at the given path. |
read_json
func read_json(path: String) -> Dictionary
Reads the contents of the file at the given path as a JSON Dictionary.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | The path to read from. |
Returns
| Type | Dictionary |
|---|---|
| Description | The JSON at the given path. |
read_image
func read_image(path: String) -> ImageTexture
Reads the contents of the file at the given path as an ImageTexture.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | The path to read from. |
Returns
| Type | ImageTexture |
|---|---|
| Description | The image at the given path. |