How can I decompress an archive file having .zst or tar.zst?

CompressionArchiveZstd

Compression Problem Overview


I do not know how I can decompress a file having .zst or tar.zst extension . The full filename :- file.pkg.tar.zst or file.xz.tar.zst

Compression Solutions


Solution 1 - Compression

The extention .zst means that the archive is compressed by zstd.

The tar command has an option -I (--use-compress-program) to specify a command for compression/decompression.

You can use it as follows.

$ tar --use-compress-program=unzstd -xvf archive.tar.zst

Solution 2 - Compression

Decompress it in Terminal.

unzstd yourfilename.zst

I know there aren't many resources available but I found this here: http://manpages.org/zstd

Solution 3 - Compression

If you have a standard cmake + gcc build stack:

git clone https://github.com/facebook/zstd.git
cd zstd/build/cmake
cmake .
make
./programs/zstd -d /path/to/file.zst

Solution 4 - Compression

On macOS Mojave 10.14.3, I was unable to specify the compression algorithm using the -I flag. Doing it this way worked for me;

Install zstd using brew if you don't already have it installed.

  1. Decompress from .zst: unzstd filename.tar.zst or zstd -d filename.tar.zst. filename.tar will be created.
  2. List compressed archive: tar tf filename.tar.
  3. Extract the compressed archive: tar xf filename.tar.

Hope this helps.

Solution 5 - Compression

I found some of these files in the Anaconda downloads. After I installed Anaconda, I was downloading additional packages. The downloaded packages in my Anaconda download directory were zip files (without the .zip extension), but they had these .tar.zst files inside them. That led me to stackoverflow to figure out what they were, which led me to this question. If you're in the same boat, then Anaconda also supplies the answer.

It turns out that the zstd and unzstd executables are also installed by the Anaconda installer, so they should be available at the command line if you're in your Anaconda environment.

Solution 6 - Compression

Download the Python library and then you can use Python like following:

import zstandard as zstd
dctx = zstd.ZstdDecompressor()
with open(submission_path_read, 'rb') as ifh, open(submission_path_save, 'wb') as ofh:
    dctx.copy_stream(ifh, ofh, write_size=65536)
Recommended Compression Solutions

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionQuarkoniaView Question on Stackoverflow
Solution 1 - Compressions-yataView Answer on Stackoverflow
Solution 2 - CompressionKaleba KB KeitshokileView Answer on Stackoverflow
Solution 3 - CompressionschuessView Answer on Stackoverflow
Solution 4 - CompressionDKMDebuginView Answer on Stackoverflow
Solution 5 - CompressionphrododView Answer on Stackoverflow
Solution 6 - CompressionJonathan LamView Answer on Stackoverflow