[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

sample[LuaStudio] Zip


SwikiCodeRobot @> 702

Zip example


Lua code

self cancelFileIn!
-- Zip.lua

local text = "test test test test test"
print(string.len(text))
local bytesForCompression = Lib.Sys.IO.Bytes.ofString(text)
compressedBytes = Lib.Sys.Zip.Compress.run(bytesForCompression, 7)
print(compressedBytes.length)
print(compressedBytes.toHex())

local uncompressedBytes = Lib.Sys.Zip.Uncompress.run(compressedBytes, nil)
print(uncompressedBytes.length)
print(uncompressedBytes.toString())