Work in progress
Godot documentation is being updated to reflect the latest changes in version
4.0. Some documentation pages may
still state outdated information. This banner will tell you if you're reading one of such pages.
The contents of this page are up to date. If you can still find outdated information, please open an issue.
Inherits: RefCounted < Object
Allows the creation of zip files.
This class implements a writer that allows storing the multiple blobs in a zip archive.
func write_zip_file(): var writer := ZIPPacker.new() var err := writer.open("user://archive.zip") if err != OK: return err writer.start_file("hello.txt") writer.write_file("Hello World".to_utf8_buffer()) writer.close_file() writer.close() return OK
close ( )
close_file ( )
start_file ( String path )
write_file ( PackedByteArray data )
ZipAppend APPEND_CREATE =
ZipAppend APPEND_CREATEAFTER =
ZipAppend APPEND_ADDINZIP =
Error close ( )
Closes the underlying resources used by this instance.
Error close_file ( )
Stops writing to a file within the archive.
It will fail if there is no open file.
Error open ( String path, ZipAppend append=0 )
Opens a zip file for writing at the given path using the specified write mode.
This must be called before everything else.
Error start_file ( String path )
Starts writing to a file within the archive. Only one file can be written at the same time.
Must be called after open.
Error write_file ( PackedByteArray data )
Write the given
data to the file.
Needs to be called after start_file.