A fast and pure-Swift command-line tool for creating and extracting TAR archives
  • Swift 99.7%
  • Makefile 0.3%
Find a file
k0pernicus 2e02a00869
All checks were successful
Swift CI / test (push) Successful in 44s
Added MIT license
2026-06-26 07:16:24 +02:00
.forgejo/workflows Updated forgejo runner 2026-06-25 22:41:10 +02:00
.github/workflows Updated github workflow 2026-06-25 22:50:46 +02:00
Sources/tsar Fixed all unit tests and binary 2026-06-25 22:24:45 +02:00
Tests/tsarTests Fixed all unit tests and binary 2026-06-25 22:24:45 +02:00
.gitignore First alpha of the CLI 2026-06-24 17:22:00 +02:00
LICENSE Added MIT license 2026-06-26 07:16:24 +02:00
Makefile Included Makefile for basic commands 2026-06-25 22:31:58 +02:00
Package.resolved Added tests helpers 2026-06-25 10:59:57 +02:00
Package.swift Added tests helpers 2026-06-25 10:59:57 +02:00
README.md Updated README to include the Makefile 2026-06-25 22:32:57 +02:00

tsar

A fast and pure-Swift command-line tool for creating and extracting TAR archives.

tsar is built on top of swift-tar.


Features

  • Create archives from directories
  • Extract archives with full directory structure preservation
  • Streaming support for memory-efficient handling of large files
  • Cross-platform: macOS, Linux, Windows.
  • No external dependencies beyond Swift standard library
  • Supports both raw and deterministic writer modes

Installation

Using Swift Package Manager

# Clone the repository
git clone https://github.com/k0pernicus/tsar.git
cd tsar

# Build in debug mode (for development)
swift build -c debug

# Build in release mode (for production)
swift build -c release

The compiled binary will be at: .build/debug/tsar or .build/release/tsar

A Makefile is available at the root of the project for building the binary (debug or release), running the tests, or cleaning temporary files.


Usage

Archive a File or Directory

# Basic usage
tsar archive /path/to/source /path/to/output.tar

# With options
tsar archive source/ output.tar \
  --writer-mode deterministic \
  --skip-hidden-files \
  --verbose

# Short flags
tsar archive source/ output.tar -m deterministic -s -v

Extract an Archive

# Basic usage
tsar unarchive input.tar /path/to/output

# With options
tsar unarchive input.tar output/ \
  --unarchiver-mode raw \
  --verbose

# Short flags
tsar unarchive input.tar output/ -m raw -v

List Archive Contents

# List contents of an archive
tsar list archive.tar

Examples

Create an archive of a project

tsar archive ~/Projects/my-app/ my-app-backup.tar -s -v

Extract to a specific directory

tsar unarchive backup.tar ~/Restored/ -m streaming

Archive with custom mode

tsar archive source/ output.tar --writer-mode complete

Troubleshooting

Command not found

Make sure the binary is in your PATH or use the full path:

.build/release/tsar archive input/ output.tar

Permission denied

Ensure you have read/write permissions for the source and destination paths.


License

MIT License