Skip to main content

A command-line tool for uploading files to Tempspace.

Project description

🚀 Tempspace

Tempspace is a self-hostable, terminal-themed file sharing service. It allows you to quickly upload files and share them via a link, with features like password protection, one-time downloads, and automatic expiration.

Screenshot of Tempspace UI

✨ Core Features

  • Seamless Uploading: Drag-and-drop web interface, cURL, or a dedicated CLI tool.
  • Chunked Uploads: Robust support for large files (default 4GB, configurable) via chunking.
  • Security Focused:
    • Password Protection: Secure individual files with a password.
    • One-Time Downloads: Links can be configured to expire after the first download.
    • Rate Limiting: Built-in protection against abuse.
  • Efficient Storage: Files with identical content are de-duplicated to save space.
  • Flexible Expiration: Set custom expiration times from hours to days.
  • Modern UI:
    • Terminal-Inspired Design: A clean, developer-focused interface.
    • QR Code Generation: Instantly generate QR codes for mobile sharing.
    • Local Upload History: Your browser remembers your recent uploads.
  • Automatic Cleanup: The server periodically cleans up expired files automatically.

🚀 Getting Started

There are three primary ways to use Tempspace.

1. Web Interface (The Easy Way)

  1. Open the service URL (e.g., https://tempspace.fly.dev/ or your self-hosted instance) in your browser.
  2. Drag and drop your file(s) or click to browse.
  3. Configure options like expiration time, password, or one-time download.
  4. Click "Upload" and share the generated link.

2. cURL (From the Terminal)

Use cURL to upload files directly from your command line.

# Basic upload (expires in 24 hours)
curl -F "file=@/path/to/your/file.txt" https://tempspace.fly.dev/upload

# Set a custom expiration time (e.g., 7 days) and password
curl -F "file=@/path/to/secret.txt" \
     -F "hours=168" \
     -F "password=secret123" \
     https://tempspace.fly.dev/upload

# Create a one-time download link
curl -F "file=@/path/to/onetime.zip" \
     -F "one_time=true" \
     https://tempspace.fly.dev/upload

3. Official CLI Tool

For the best terminal experience, install the official CLI tool from PyPI.

Installation

pip install tempspace-cli

Usage

# Interactive mode (prompts for all options)
tempspace --it

# Basic upload (expires in 24 hours)
tempspace /path/to/document.pdf

# Set expiration to 7 days and add a password
tempspace /path/to/archive.zip -t 7d -p "secure_password"

# Display a QR code in the terminal after upload
tempspace /path/to/image.png --qr

# Point to a self-hosted server
tempspace /path/to/file.txt --url http://localhost:8000

🔧 Self-Hosting

You can easily run your own instance of Tempspace using Docker or by running the source code directly.

Method 1: Using Docker (Recommended)

  1. Clone the repository:

    git clone https://github.com/Bartixxx32/tempspace.git
    cd tempspace
    
  2. Build the Docker image:

    docker build -t tempspace-app .
    
  3. Run the container: Create a .env file to configure your admin password.

    cp .env.example .env
    nano .env  # Set your ADMIN_PASS
    

    Then, run the container, mounting the environment file and a volume for persistent storage.

    docker run -d \
      -p 8000:8000 \
      --name tempspace \
      --env-file .env \
      -v $(pwd)/uploads:/app/uploads \
      tempspace-app
    

    Your Tempspace instance will be available at http://localhost:8000.

Method 2: Running from Source

  1. Clone the repository:

    git clone https://github.com/Bartixxx32/tempspace.git
    cd tempspace
    
  2. Install dependencies: It's recommended to use a virtual environment.

    python -m venv venv
    source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
    pip install -r requirements.txt
    
  3. Configure: Copy the example environment file and set your admin password.

    cp .env.example .env
    nano .env
    
  4. Run the server:

    python -m uvicorn main:app --host 0.0.0.0 --port 8000
    

⚙️ Configuration (Environment Variables)

Configure your Tempspace instance by creating a .env file in the project root.

Variable Description Default
ADMIN_USER Username for accessing debug/admin endpoints. admin
ADMIN_PASS Required. Password for the admin user. The app will not start without this. changeme123
MAX_FILE_SIZE Maximum file size in bytes. 4294967296 (4GB)
RATE_LIMIT_UPLOADS Max uploads per IP per hour. 10
RATE_LIMIT_DOWNLOADS Max downloads per IP per hour. 100
RATE_LIMIT_WINDOW The rate limit time window in seconds. 3600 (1 hour)

🛠️ API & Admin Endpoints

  • /upload: The primary endpoint for curl and simple POST request uploads.
  • /upload/initiate, /upload/chunk, /upload/finalize: Endpoints for the chunked upload flow used by the web UI and CLI.
  • /health: A public health check endpoint.
  • /debug/stats: (Admin-only) View detailed statistics of all stored files.
  • /debug/wipe: (Admin-only) Destructive. Deletes all files and metadata.

Access admin endpoints by providing the admin credentials via HTTP Basic Authentication.

🤝 Contributing

Contributions are welcome! Please fork the repository, make your changes, and submit a pull request.

📝 License

This project is licensed under the MIT License.

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

tempspace_cli-1.2.3.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

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

tempspace_cli-1.2.3-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file tempspace_cli-1.2.3.tar.gz.

File metadata

  • Download URL: tempspace_cli-1.2.3.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tempspace_cli-1.2.3.tar.gz
Algorithm Hash digest
SHA256 a13979665c4fb9b8532f6167fdaae0b0a2248174ca9971b2677d3173f951e539
MD5 2524283fa312ca15c35502915c887669
BLAKE2b-256 e629da4203e04504ff586bccd854d187003f1dd6d2a934825465170ee8b8c333

See more details on using hashes here.

File details

Details for the file tempspace_cli-1.2.3-py3-none-any.whl.

File metadata

  • Download URL: tempspace_cli-1.2.3-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tempspace_cli-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c9f0c3b797ca5752afd88b0073df13969813a1d0713921d726654a451b13fd66
MD5 743c962c0df4b39ad978b44cb1de6704
BLAKE2b-256 03db2cc13d52ddaa2196822d18d30fe74462d2cf60213dea7168a6500482adb7

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