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