zip_unzip_async

The function is the asynchronous equivalent of zip_unzip. It takes a path to a ZIP file, and the target directory where it should be extracted.

If the call is successful, a request ID is returned, and later the Async Save / Load event is triggered where this ID can be checked. The async_load map in that event will contain the following keys:

This function will trigger a fatal error if it's called between buffer_async_group_begin and buffer_async_group_end calls.

Please read the zip_unzip page for file system limitations.

NOTE This functionality is not available for the HTML5 target platform.

 

Syntax:

zip_unzip_async(zip_file, target_directory);

ArgumentTypeDescription
zip_fileStringThe zip file to open
target_directoryStringThe target directory to extract the files to

 

Returns:

Real

 

Example:

level_data_request = zip_unzip_async("/downloads/level_data.zip", working_directory + "extracted/");

Async Save/Load event

var _id = async_load[? "id"];

if (_id == level_data_request)
{
    var _status = async_load[? "status"];

    if (_status < 0)
    {
        show_debug_message("ZIP file extraction failed.");
    }
}

The above code attempts to extract a ZIP file into the working directory. In the Async Save/Load event, it checks the status of that request, and prints a message to the output log if it failed.