Skip to main content

HTTP/HTTPS downloader with cross-session resume, integrity verification, and HuggingFace support

Project description

downcraft

Generic HTTP/HTTPS downloader with cross-session resume via HTTP Range headers. Survives power loss, process crashes, and days-long gaps between sessions.

Quick start

pip install downcraft

# Download any URL
downcraft url https://example.com/bigfile.iso /tmp/bigfile.iso

# Or a HuggingFace model
downcraft hf Qwen/Qwen2.5-0.5B-Instruct

# Check status
downcraft status https://example.com/bigfile.iso

# List all tracked downloads
downcraft list

How resume works

  1. Download starts → writes to file.sgpart
  2. Process crashes or connection drops → .sgpart + ~/.downcraft/state.json survive
  3. Same URL requested again → detects .sgpart, sends Range: bytes=N- to server
  4. Server sends only remaining bytes → appended to .sgpart
  5. On completion → atomically renames to final filename

Python API

from downcraft import download

# Generic URL
result = download("https://example.com/bigfile.iso", "/tmp/bigfile.iso")
print(result["status"])  # "complete"

# With progress callback
def on_progress(downloaded, total, speed_bps):
    pct = int(downloaded / total * 100) if total else 0
    print(f"\r{pct}% @ {speed_bps/1e6:.1f} MB/s", end="")

download("https://...", "/tmp/file", on_progress=on_progress)

# HuggingFace model (requires huggingface-hub)
from downcraft import download_hf_model

result = download_hf_model("gpt2")
print(result["cache_dir"])  # path to HF cache

CLI

Command Description
downcraft url <url> <dest> Download any file
downcraft hf <model_id> Download HF model
downcraft status <key> Check download status
downcraft list List all tracked
downcraft verify <key> Verify integrity

Dependencies

  • requests (required) — HTTP with Range header support
  • huggingface-hub (optional) — only needed for HF model commands

Install with HF support: pip install downcraft[hf]

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

downcraft-0.2.0-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file downcraft-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: downcraft-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for downcraft-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2d8652af7b828e5ea6d15474c3ce0872721e5ba31ab01c77f4b20ba9989ead8
MD5 3f4fe8085d117f0642b8251060fac93c
BLAKE2b-256 f1b5f92f9289426c16911c64a5555cee978b9b19d1fbe3c2a42fd2eaa08c76c9

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