zstdcompress Synchronous
crypt.zstd.compress
Compress a byte string using Zstandard and an optional compression level. Use it for compact storage of larger text or binary content. Compression returns binary data, so Base64-encode it separately if the destination only accepts text.
Luau
zstdcompress(data: string, level: number?) -> stringParameters
| Parameter | Type | Description |
|---|---|---|
data | string | Uncompressed bytes. |
level | number? | Integer from -131072 through 22. Defaults to 1. |
Returns
stringCompressed bytes as a Luau string.
Example
Luau
local packed = zstdcompress("hello hello hello", 1)
print(zstddecompress(packed)) -- hello hello hello