A Go utility that walks a directory tree and streams a tar archive, while uncompressing XZ on-the-fly.
Useful for injecting thar flat tar into a deduplicating backup system such as Borg or Restic.
- Recursively processes directories
- Automatically decompresses
.xzfiles while streaming to tar - Copies non-compressed files as-is
- The tar is fully streamed without using disk storage
- Multi-threaded XZ decompression (configurable)
- Outputs to stdout or file
- Go 1.x or later (for building)
xzutility must be installed and available in PATH
make build
sudo make installmake build-linux-amd64
make build-linux-arm64
make build-windows-amd64
make build-darwin-arm64
# Or build all targets
make allSEMVER=1.0.0 make build-linux-amd64 package-amd64-linuxThis creates .deb, .rpm, .ipk, and Arch Linux packages in the dist/ directory.
stream_tar_from_xz <path_to_directory> [optional: output_file]Output to stdout:
stream_tar_from_xz /path/to/dir > output.tarOutput to file:
stream_tar_from_xz /path/to/dir output.tarSet the number of XZ decompression threads via environment variable:
XZ_NUM_THREADS=4 stream_tar_from_xz /path/to/dirDefault: number of CPU cores
- Walks the input directory recursively
- For
.xzfiles: queries uncompressed size, decompresses on-the-fly, and streams to tar without.xzextension - For other files: copies directly to tar
- Preserves directory structure and file metadata
See LICENSE file for details.