Why is there not a pure Lua implementation of ZSTD compression

I was looking through modules related to compression on the devforum Such as String Compression (zlib/deflate)

But I couldn’t find a single ZSTD compression and decompression module made in Lua.

Is it just impossible to make or has nobody thought of it yet?

1 Like

This is the Module;

1 Like

Oh no, I am talking about ZSTD not Zlib sorry about the confusion

Notice how it uses C libraries to do the trick…

1 Like

So if you’re looking to use ZSTD in Roblox, you’d need a pure Lua ZSTD implementation
None exist I was able to locate.

May have to use a custom HTTP API hosted on a server that runs ZSTD compression/decompression
With Roblox communicating with it via HttpService.

Interesting research however.
Good luck.

1 Like

Fun fact:

When you pass a string to buffer.fromstring(), the string will automatically be compressed with ZSTD compression! You can theoretically pass the buffer object to HttpService:JSONEncode(), it would give you that compressed string encoded in zbase64 (or normal base64 in short strings) and it would be possible to get the raw ZSTD compressed string by just decoding the zbase64. You could also reverse that process by encoding the compressed string in zbase64, reconstructing the JSON and passing it to HttpService:JSONDecode(), and that should give you a buffer object which you can use buffer.tostring() on, and you would have the decompressed string.

5 Likes

Yes, but

That is obviously not a
image

Oh, I apologize. My mind didn’t process the word “pure” earlier.

It definitely is possible, it’s just… torture.

2 Likes

part of me wants to wasynth a zstd impl so people stop asking for this.

zstd has a really confusing specification which is why this doesn’t exist yet. Theres a basic decompressor written in pure C99 on the repo that you could copy but that only decompresses.

1 Like