ZIPReader
Inherits: RefCounted < Object
Description
Section titled “Description”Allows reading the content of a ZIP file.
This class implements a reader that can extract the content of individual files inside a ZIP archive. See also ZIPPacker.
Methods
Section titled “Methods”| Returns | Method |
|---|---|
| Error | close() |
| bool | file_exists(path: String, case_sensitive: bool = true) |
| int | get_compression_level(path: String, case_sensitive: bool = true) |
| PackedStringArray | get_files() |
| Error | open(path: String) |
| PackedByteArray | read_file(path: String, case_sensitive: bool = true) |
Method descriptions
Section titled “Method descriptions”close
Error close()
Closes the underlying resources used by this instance.
file_exists
bool file_exists(path: String, case_sensitive: bool = true)
Returns true if the file exists in the loaded zip archive.
Must be called after open().
get_compression_level
int get_compression_level(path: String, case_sensitive: bool = true)
Returns the compression level of the file in the loaded zip archive. Returns -1 if the file doesn’t exist or any other error occurs. Must be called after open().
get_files
PackedStringArray get_files()
Returns the list of names of all files in the loaded archive.
Must be called after open().
open
Opens the zip archive at the given path and reads its file index.
read_file
PackedByteArray read_file(path: String, case_sensitive: bool = true)
Loads the whole content of a file in the loaded zip archive into memory and returns it.
Must be called after open().
