mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-05 22:09:56 +03:00
classref: Sync with current master branch (fc1c25d29)
This commit is contained in:
88
classes/class_zipreader.rst
Normal file
88
classes/class_zipreader.rst
Normal file
@@ -0,0 +1,88 @@
|
||||
:github_url: hide
|
||||
|
||||
.. DO NOT EDIT THIS FILE!!!
|
||||
.. Generated automatically from Godot engine sources.
|
||||
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
|
||||
.. XML source: https://github.com/godotengine/godot/tree/master/modules/zip/doc_classes/ZIPReader.xml.
|
||||
|
||||
.. _class_ZIPReader:
|
||||
|
||||
ZIPReader
|
||||
=========
|
||||
|
||||
**Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
||||
|
||||
Allows reading the content of a zip file.
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
This class implements a reader that can extract the content of individual files inside a zip archive.
|
||||
|
||||
::
|
||||
|
||||
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
|
||||
|
||||
Methods
|
||||
-------
|
||||
|
||||
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`close<class_ZIPReader_method_close>` **(** **)** |
|
||||
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_files<class_ZIPReader_method_get_files>` **(** **)** |
|
||||
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`open<class_ZIPReader_method_open>` **(** :ref:`String<class_String>` path **)** |
|
||||
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`read_file<class_ZIPReader_method_read_file>` **(** :ref:`String<class_String>` path, :ref:`bool<class_bool>` case_sensitive=true **)** |
|
||||
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
Method Descriptions
|
||||
-------------------
|
||||
|
||||
.. _class_ZIPReader_method_close:
|
||||
|
||||
- :ref:`Error<enum_@GlobalScope_Error>` **close** **(** **)**
|
||||
|
||||
Closes the underlying resources used by this instance.
|
||||
|
||||
----
|
||||
|
||||
.. _class_ZIPReader_method_get_files:
|
||||
|
||||
- :ref:`PackedStringArray<class_PackedStringArray>` **get_files** **(** **)**
|
||||
|
||||
Returns the list of names of all files in the loaded archive.
|
||||
|
||||
Must be called after :ref:`open<class_ZIPReader_method_open>`.
|
||||
|
||||
----
|
||||
|
||||
.. _class_ZIPReader_method_open:
|
||||
|
||||
- :ref:`Error<enum_@GlobalScope_Error>` **open** **(** :ref:`String<class_String>` path **)**
|
||||
|
||||
Opens the zip archive at the given ``path`` and reads its file index.
|
||||
|
||||
----
|
||||
|
||||
.. _class_ZIPReader_method_read_file:
|
||||
|
||||
- :ref:`PackedByteArray<class_PackedByteArray>` **read_file** **(** :ref:`String<class_String>` path, :ref:`bool<class_bool>` case_sensitive=true **)**
|
||||
|
||||
Loads the whole content of a file in the loaded zip archive into memory and returns it.
|
||||
|
||||
Must be called after :ref:`open<class_ZIPReader_method_open>`.
|
||||
|
||||
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
||||
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
|
||||
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
|
||||
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
|
||||
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
|
||||
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
|
||||
Reference in New Issue
Block a user