MartinElvar
Decompressing file with Zstd
I’m trying to decompress a zstd compressed file using the Elixir, and the library https://github.com/chenzhuoyu/elixir-zstd
I’ve tried the following
{:ok, content} = File.read("myfile")
<<header :: binary-size(12), remainder :: binary>> = content
{:ok, orig} = ExZstd.simple_decompress(remainder)
-> ** (MatchError) no match of right hand side value: {:error, 'Unable to determain decompressed size'}
There er no problems when running the zstd command from the terminal.
I’ve also trying the streaming solution, found in the test example.
But i fail to see how i get the tail, when the data is from a file, and not a compression stream.
Any who can help me out, or should i simply resort to calling the zstd command directly from my code.
Most Liked
sribe
I don’t know this library, but I bet you need to pass the whole file contents in rather than discarding the header.
MartinElvar
Yes, i’ve have tried writing remainder to a file, and then decompress it with zstd -d myfile.zst no problem. Maybe it’s version mismatch.
OvermindDL1
It’s possible, it doesn’t look like that library links a built in zstd library but rather just whatever is available on the system. Maybe try a little hoist program to confirm that, like python with ffi for a quick link and test or so?







