Skip to content

Commit

Permalink
Support zstd as a compression backend
Browse files Browse the repository at this point in the history
zstd is faster at compressing and decompressing than gzip, and results in small files
  • Loading branch information
Amir-Ahmad committed Oct 30, 2024
1 parent c9e0a43 commit 24bd864
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/backends/s3.bash
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ if [[ ! "$OSTYPE" == "darwin"* ]]; then
fi
BK_TAR_EXTENSION="tar.gz"
BK_TAR_EXTRACT_ARGS="-xzf"

if [[ "${BK_CACHE_COMPRESS_PROGRAM}" == zstd ]]; then
BK_TAR_EXTENSION="tar.zst"
BK_TAR_ARGS=("$BK_TAR_ADDITIONAL_ARGS" --use-compress-program "zstd" -cf)
BK_TAR_EXTRACT_ARGS="--use-compress-program zstd -xf"
fi
else
BK_TAR_ARGS=("$BK_TAR_ADDITIONAL_ARGS" -cf)
fi
Expand Down
6 changes: 6 additions & 0 deletions lib/backends/tarball.bash
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ if [[ ! "$OSTYPE" == "darwin"* ]]; then
fi
BK_TAR_EXTENSION="tar.gz"
BK_TAR_EXTRACT_ARGS="-xzf"

if [[ "${BK_CACHE_COMPRESS_PROGRAM}" == zstd ]]; then
BK_TAR_EXTENSION="tar.zst"
BK_TAR_ARGS=("$BK_TAR_ADDITIONAL_ARGS" --use-compress-program "zstd" -cf)
BK_TAR_EXTRACT_ARGS="--use-compress-program zstd -xf"
fi
else
BK_TAR_ARGS=("$BK_TAR_ADDITIONAL_ARGS" -cf)
fi
Expand Down

0 comments on commit 24bd864

Please sign in to comment.