Skip to content

Instantly share code, notes, and snippets.

@shmerl
Created February 21, 2024 00:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shmerl/a42fb90fbf2d5958126d9c5b6a503c2b to your computer and use it in GitHub Desktop.
Save shmerl/a42fb90fbf2d5958126d9c5b6a503c2b to your computer and use it in GitHub Desktop.
For convenient extraction of zstd archives
#!/bin/bash
source="$1"
if [[ "$source" == "" ]]; then
echo "Error: No source provided!"
exit 1
fi
if ! [[ -e "$source" ]]; then
echo "Error: ${source} doesn't exist!"
exit 2
fi
if [[ "$source" == *.tar.zst ]]; then
tar --extract --verbose --use-compress-program "zstd --threads=$(nproc) --decompress --verbose" --file "$source"
else
zstd --threads=$(nproc) --decompress --verbose "$source"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment