Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
ZIPReader¶
继承: RefCounted < Object
允许读取 zip 文件的内容。
描述¶
该类实现了一个可以提取 zip 存档中各个文件内容的读取器。
func read_zip_file():
var reader := ZIPReader.new()
var err := reader.open("user://archive.zip")
if err != OK:
return PackedByteArray()
var res := reader.read_file("hello.txt")
reader.close()
return res
方法¶
close ( ) |
|
file_exists ( String path, bool case_sensitive=true ) |
|
get_files ( ) |
|
方法说明¶
Error close ( )
关闭该实例底层所使用的资源。
bool file_exists ( String path, bool case_sensitive=true )
如果加载的 zip 存档中存在对应的文件,则返回 true
。
必须在 open 之后调用。
PackedStringArray get_files ( )
返回加载的存档中所有文件的名称列表。
必须在 open 之后调用。
打开给定 path
的压缩文件,并读取其文件索引。
PackedByteArray read_file ( String path, bool case_sensitive=true )
将加载的 zip 存档中文件的全部内容加载到内存中并返回它。
必须在 open 之后调用。