#LZW Data Compression (fast and pretty good)

1 messages · Page 1 of 1 (latest)

blazing coyote
#

ok discord wont allowe me to send the module so lemme send devforum link

#

Global Framework Interface

--!strict
local Global = require("PathToGlobalFramework")
local httpService = game:GetService("HttpService")
local lzw = require("PathToLZW")
local lzwBuffer = lzw.new()

Global("JsonEncode", function(input: any): string
    return httpService:JSONEncode(input)
end :: (input:any) -> string)

Global("JsonDecode", function(value: any): string
    return httpService:JSONDecode(value)
end :: (input:string) -> any)

Global("Compress", function(text:string): string
    return lzwBuffer:compress(text)
end :: (text:string) -> string)

Global("Decompress", function(compressedText:string): string
    return lzwBuffer:decompress(compressedText)
end :: (compressedText:string) -> string)

Global("JsonEncodeAndCompress", function(value:any):string
    return lzwBuffer:compress(httpService:JSONEncode(value))
end :: (value:any) -> string)

Global("DecompressAndJsonDecode", function(value:string):string
    return httpService:JSONDecode(lzwBuffer:decompress(value))
end :: (value:string) -> any)
#

I recommend using this for something big, like a map file