shahryarjb
Extract tar file and invalid_tar_checksum
Hi, I have downloaded a file (the file) from GitHub and wanted to extract it, but I got {:error, :invalid_tar_checksum} error. I extracted it with my Mac software, and it had no problem.
My code:
def extract(:tar, archived_file, extracted_name) do
file = File.open!("#{extensions_path()}/#{archived_file}.tar")
:erl_tar.extract(
{:file, file},
[
{:cwd, ~c'#{extensions_path()}/#{extracted_name}'}
]
)
end
OR
def extract(:tar, archived_file, extracted_name) do
:erl_tar.extract(
~c'#{extensions_path()}/#{archived_file}.tar',
[
{:cwd, ~c'#{extensions_path()}/#{extracted_name}'}
]
)
end
OR for original file
:erl_tar.extract(~c'./Downloads/mishka-group-mishka_installer-0.0.3-0-g2ba83e0.tar.gz')
Even test
Finch.build(:get, "https://codeload.github.com/mishka-group/mishka_installer/legacy.tar.gz/refs/tags/0.0.3")
|> Finch.request(DownloaderClientApi)
|> case do
{:ok, %Finch.Response{status: 200, body: body}} -> :erl_tar.extract({:binary, body})
_ -> {:error, :download_tar_from_github, :not_found}
end
Thank you in advance
Marked As Solved
shahryarjb
It needs :compressed flag
:erl_tar.extract(
~c'#{extensions_path()}/#{archived_file}.tar.gz',
[:compressed, {:cwd, ~c'#{extensions_path()}/#{archived_file}'}]
)
Popular in Questions
Hi! May someone helps me, please!
I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
15:22:35.803 [error] gen_event {lager_file_backend...
New
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
can someone please explain to me how Enum.reduce works with maps
New
I have a User schema with a :from_id field set to type :string:
defmodule TweetBot.Repo.Migrations.CreateUsers do
use Ecto.Migration
...
New
I’m currently trying to understand how to join three tables using Ecto. All the examples I’ve seen use 2, so maybe I’m just missing somet...
New
Hi guys, i’m new in the Elixir world, and i have to say, that i love it!
i’m having some problem to understand anonymous functions with ...
New
Sometimes I want to check if the input into a function is not a blank string.
My first approach:
defmodule Example do
def do_stuff(s...
New
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size?
Thanks
New
I am trying to run a deploy with docker and I successfully runned with this command:
docker build -t romenigld/blog-prod .
but when I t...
New
Other popular topics
Hello, I get Persian date from my client and convert it to normal calendar like this:
def jalali_string_to_miladi_english_number(persi...
New
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
Credo is smart enough to check for (something like) this:
assert length(the_list) == 0
with this response:
Checking if an enum is empt...
New
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode.
The solution seems to be, in a hyphena...
New
As a follow up to my earlier question:
I have the code compiling and running but not getting a successful login from the rest server. ...
New
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
Hi,
I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
Hello everybody,
usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
by Lance Halvorsen
Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
New







