MartinElvar
Decompressing file with Zstd
I’m trying to decompress a zstd compressed file using the Elixir, and the library GitHub - chenzhuoyu/elixir-zstd: Elixir binding of the Zstandard library · GitHub
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.
https://github.com/chenzhuoyu/elixir-zstd/blob/master/test/ex_zstd_test.exs
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?
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security









