Skip to main content

Pack/unpack multiple files into a single file

Project description

txtpack

A Python CLI tool for bundling and unbundling files using pattern matching, featuring pack and unpack commands that preserve file integrity through byte-accurate delimiters. The tool supports glob patterns for file selection and enables round-trip workflows where multiple files can be packed into a single stream and later reconstructed back to their original individual files.

Installation

Via uv (recommended)

uvx txtpack

Via pip

pip install txtpack

Usage Examples

Basic File Packing

# Pack all Python files to stdout
uv run txtpack pack "*.py"

# Pack files matching a specific pattern
uv run txtpack pack "config-*"

# Save packed files to a bundle file
uv run txtpack pack "*.md" > bundle.txt

File Unpacking

# Unpack from a bundle file
uv run txtpack unpack --input bundle.txt

# Unpack to a specific directory
uv run txtpack unpack --input bundle.txt --output-dir ./restored/

# Unpack from stdin (pipeline usage)
cat bundle.txt | uv run txtpack unpack

Round-trip Workflows

# Pack and immediately unpack files
uv run txtpack pack "src/*.py" | uv run txtpack unpack --output-dir ./backup/

# Create a bundle and restore it later
uv run txtpack pack "docs/*.md" > docs-bundle.txt
uv run txtpack unpack --input docs-bundle.txt --output-dir ./restored-docs/

Advanced Usage

# Pack files from a specific directory
uv run txtpack pack "*.json" --directory ./config/

# Use regex patterns for more complex matching
uv run txtpack pack "test_.*\.py"

# Chain multiple operations
uv run txtpack pack "*.yaml" > config.bundle && \
  uv run txtpack unpack --input config.bundle --output-dir ./deploy/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

txtpack-1.2.0.tar.gz (10.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

txtpack-1.2.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file txtpack-1.2.0.tar.gz.

File metadata

  • Download URL: txtpack-1.2.0.tar.gz
  • Upload date:
  • Size: 10.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.20

File hashes

Hashes for txtpack-1.2.0.tar.gz
Algorithm Hash digest
SHA256 3ff5d8ed828e53890d00b1041b17da6a3e9152687480a8594988ceaca03e0f5c
MD5 dba23ad6dcfa1a958727536d04d2f079
BLAKE2b-256 265582c0de3074a6117ba6e916ca6e1fbdfff4e0aee7337eff53076fc9830a78

See more details on using hashes here.

File details

Details for the file txtpack-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: txtpack-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.20

File hashes

Hashes for txtpack-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8cc6fe727897db5f0d58f26676cbf65a1bbccf4186f8202a9d065adf7078f7f5
MD5 8f41eb0ffbb678cbe3e017e0a84ca0d1
BLAKE2b-256 e9d001fdd02ab73f9f3a9b3578a9efae22d7b5bed79661fe1045fc61073953a0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page