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.1.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.1.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for txtpack-1.1.0.tar.gz
Algorithm Hash digest
SHA256 6608d1707ce2b0ff6129c7f61e9cb78ee330f298b7872fc628c9ce0c9cbd4c43
MD5 4ee88006e8071045897a7fbd74ceeaa1
BLAKE2b-256 506f198dce484657c2933e4c8be9583a45fdf3102a42abf495e8559c5e196b20

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for txtpack-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 92c40b8d03672833e67b69ce53975d9d5df789d0abdf0718ab84ffe413ff9860
MD5 ab94797ab8ac17ac80974d1701dd3469
BLAKE2b-256 bcd5df16f5f2198a2d20ae3a254b0ed0ee3f49389208c7482686cd728026838e

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