Skip to main content

Next-generation parallel P2P LAN file transfer

Project description

QuickSharePy

QuickSharePy is a tiny zero-configuration Python utility to share any folder over your local network. No cloud, no accounts — just run one command and other devices on the same LAN can browse and download files using a web browser.

Features

  • Instant setup: share the current folder with one command
  • LAN-based access: other devices on the same Wi‑Fi/LAN can connect
  • Optional password (Bearer token) for basic access protection
  • Optional QR code output for quick mobile access (requires qrcode)
  • Optional upload support via HTML form (enabled by default in the script)
  • Cross-platform — runs anywhere Python 3 is available

This repository also contains a next-generation parallel P2P file transfer engine (co-existing with the original HTTP share script). The new tool is designed for high-speed LAN transfers using parallel TCP streams and simple peer discovery.

Quick start

  1. (Optional) Install optional dependencies for QR and colored output:
python -m pip install qrcode colorama
  1. Run in the folder you want to share (or pass a folder):
# Share current folder on default port 8080
python quickshare.py

# Share a specific folder on port 8080
python quickshare.py "C:\path\to\folder" --port 8080

# Enable password (clients must send header Authorization: Bearer mypass)
python quickshare.py . --password mypass

# Show QR code (requires `qrcode` package)
python quickshare.py . --qr

When running you'll see output like:

🚀 QuickSharePy
Serving folder: C:\path\to\folder
Access at: http://192.168.1.25:8080

✅ Server running. Press Ctrl+C to stop.

Open the displayed URL from another device on the same network.


Next‑gen P2P file transfer (new)

This project includes a parallel, chunked, P2P transfer engine with these capabilities:

  • Peer discovery on LAN via UDP announcements
  • TCP control handshake (offer / accept / port list)
  • Parallel chunked data transfer: one TCP stream per chunk
  • Receiver-side preallocation and per-chunk + full-file SHA256 verification
  • CLI for discovery, sending, and receiving with real-time progress/ETA
  • Robustness: connection retries and per-block send retries

Core modules and where to find them:

  • quickshare/discovery.py — UDP announcer and listener (DiscoveryManager)
  • quickshare/control.py — TCP control handshake (ControlServer, send_control_offer)
  • quickshare/transfer.py — Sender and Receiver (parallel chunked transfer)
  • quickshare/fileutils.py — preallocation, chunk writes, hashing helpers
  • quickshare/cli.py — CLI: list, send, recv commands and progress UI

Run the built-in tests to verify everything:

PYTHONPATH=$(pwd) pytest -q

CLI usage examples

  • Discover peers (prints a short list):
python -m quickshare.cli list --wait 1.0
  • Send a file to a discovered peer (interactive selection if --peer omitted):
python -m quickshare.cli send --file /path/to/file --wait 1.0
# or specify peer index from `list`:
python -m quickshare.cli send --peer 0 --file /path/to/file
  • Run a receiver (accept offers and save incoming files):
python -m quickshare.cli recv --port 60000 --out ./received

Progress, throughput and retries

  • The CLI displays a single-line progress bar with percentage, completed chunks, bytes transferred, average throughput (KB/s), and ETA (MM:SS).
  • Progress updates are rate-limited to at most 4 updates per second to avoid terminal flicker on very fast transfers.
  • Each chunk is streamed in 64 KiB blocks and the CLI updates per-block.
  • Retry behavior:
    • Connection establishment retries up to 3 times with exponential backoff.
    • Each block send is retried up to 2 times with a short backoff.

Configuration options (CLI flags)

  • --bind — the address to bind discovery and/or receivers (default 127.0.0.1)
  • --bind-port — discovery UDP port (default 37020)
  • --port / --local-port — control TCP port to listen/announce
  • --chunk-size — logical chunk size (default 1 MiB)
  • Block streaming size (internal): 64 KiB per-block (tunable in code)

Notes on robustness and future work

  • Current retry logic covers transient connection or send failures. If a connection is lost mid-chunk the receiver currently does not support resuming the same chunk (that would require protocol extensions).
  • Future improvements (recommended for later releases): resumable chunk transfers, TLS for control/data, EMA smoothing for ETA, transfer logs.

Uploads

The root directory listing includes a simple file upload form that saves uploaded files to the current directory. This is intentionally minimal — treat uploads as an opt-in, local convenience.

Improvements in this version:

  • Uploads are saved into an uploads/ subfolder by default.
  • Filenames are sanitized to avoid directory traversal and unsafe characters.
  • The server enforces a maximum upload size (default 200 MB). You can customize via environment variables:
# Example (PowerShell):
$env:QUICKSHARE_UPLOAD_DIR = 'C:\path\to\uploads'
$env:QUICKSHARE_MAX_UPLOAD_BYTES = 104857600  # 100 MB
python quickshare.py

Notes: Uploaded files will get a numeric suffix if a file with the same name already exists to avoid accidental overwrite.

Security notes

  • Password protection is a simple Bearer token checked against the Authorization header.
  • This tool is intended for trusted local networks only. Do not expose the port to the public internet.

Future ideas

  • HTTPS support
  • Persistent bookmarks and config
  • Drag-and-drop web UI

License

MIT

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

quickshare_py-1.0.8.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

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

quickshare_py-1.0.8-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file quickshare_py-1.0.8.tar.gz.

File metadata

  • Download URL: quickshare_py-1.0.8.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for quickshare_py-1.0.8.tar.gz
Algorithm Hash digest
SHA256 4d79c69a159b68d95e9cbd1ddda48a262631930e55059d7760187daf76292fa5
MD5 1b28318ddf58a7390ee5cad42c332442
BLAKE2b-256 8f7e647836d8fd3a2fe3399965e5cdced2fc5ef9ae722e73fbc23f073da4b3d6

See more details on using hashes here.

File details

Details for the file quickshare_py-1.0.8-py3-none-any.whl.

File metadata

  • Download URL: quickshare_py-1.0.8-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for quickshare_py-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 891a932bdfce0b18df41adab623db6b72d3b5109dd913ecef81c92d886305dad
MD5 1e85f6051eda2d559ce7b3bb99cab15e
BLAKE2b-256 1c07f0083229d97f1102cf16da226e1ed803e94d100945455752922bf4fd33cc

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