19.09.2022, 06:39
/tmp is RAM-based file system so you can safely write there as many time as needed. Just make sure to remove any unused files or you can run out of memory in certain cases.
Another option is to use this library: https://raw.githubusercontent.com/hamish...i-zlib.lua
Add is as user library named zlib.
Usage example:
Another option is to use this library: https://raw.githubusercontent.com/hamish...i-zlib.lua
Add is as user library named zlib.
Usage example:
Code:
zlib = require('user.zlib')
input = '...' -- binary string containing gzip data
offset = 1
buffer = {}
zlib.inflateGzip(function(size)
local chunk = input:sub(offset, offset + size - 1)
offset = offset + size
if #chunk > 0 then
return chunk
end
end,
function(chunk)
buffer[ #buffer + 1 ] = chunk
end)
output = table.concat(buffer)