Unzipping files at runtime?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By gp1

Hi,
what’s the official/best way of unzipping downloaded files at runtime with 3.2.2?

:bust_in_silhouette: Reply From: tuon

There’s a method on the File class for opening a compressed file. Check it out here.

https://docs.godotengine.org/en/stable/classes/class_file.html#class-file-method-open-compressed

Thank you.
In the case of the zipped file containing multiple files, is it possible to unzip them separately?

gp1 | 2020-08-12 20:33

Not with the File class. But there is a propsal and pull request to add it to Godot. For now, someone created an implemntation for this in GDScript. Here’s the github repo link for that. I would give that a try.

jellehermsen/gdunzip

For the proposal look here.

tuon | 2020-08-12 22:15

Thank you, I will give it a try.

gp1 | 2020-08-13 02:21