buffer_decompress(buffer)

From ENIGMA
Jump to navigation Jump to search

Description

Decompress the contents of a buffer using the zlib library

This function decompresses the data stored in a buffer 16 kilobytes at a time, and a new buffer is created to store the decompressed data.

Parameters

Parameter Data Type Description
buffer buffer_t The handle to the buffer being decompressed

Return Values

buffer_t: The handle to the buffer containing the decompressed data

Example Call

// demonstrates decompressing the string "Many hands make light work."
var str = "Many hands make light work.";
var buf = buffer_create(8, buffer_grow, 1);
buffer_write(buf, buffer_string, str);

var buf2 = buffer_compress(buf, 0, buffer_get_size(buf));
var buf3 = buffer_decompress(buf2);