Decompress
Restore a previously compressed buffer to its original string — called automatically by the Network layer when a route uses compress = true.
API
Manual decompression
local Codec = RoExpress.Codec
local back = Codec.LZH:Decompress(packed)
local tbl = game:GetService("HttpService"):JSONDecode(back)
Auto-decompression on the Network side
When a route is registered with compress = true, App compresses the response before sending it. The Network module on the client detects the compressed payload and calls Decompress automatically before handing data to your callback. The response object sets compressed = true so you can confirm it happened:
-- Client | data is already decompressed
network:Get("map/data", nil, function(res)
print(res.compressed) -- true
loadMap(res.data)
end)
Error on non-compressed input
Calling Decompress on data that was not produced by Compress will error. Use Codec:IsCompressed to guard against this when the source is unknown:
if Codec:IsCompressed(data) then
data = Codec.LZH:Decompress(data)
end
See also
← Codec · Compress | LZ77 and LZH compression · Route Integration | compress = true on routes · Network | client-side request module