blazeserve


Nameblazeserve JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryFast, dependable HTTP file server for sharing files and folders — supports byte-range/multi-range downloads, TLS, Basic Auth, throttling, uploads, streaming ZIP, CORS, and a polished CLI.
upload_time2025-10-10 20:52:51
maintainerNone
docs_urlNone
authorJaydeep Solanki
requires_python>=3.9
licenseMIT
keywords http file-server range resume download cli rich click cors zip throttle
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # BlazeServe

Fast, dependable HTTP file server for sharing files and folders. Supports byte-range and multi-range downloads, TLS, Basic Auth, throttling, uploads, streaming ZIP, optional CORS, and a modern, colorful CLI.

## Features

- Static file serving over HTTP/1.1 with strong ETag, Last-Modified, and If-Range
- Range and multi-range responses
- Zero-copy sendfile fast path, windowed mmap, and buffered fallback
- Per-connection rate limiting
- Optional directory listing with automatic index.html
- One-file mode for quick shares
- Streaming ZIP for files or directories (`/__zip__?path=...`)
- Uploads via `PUT`/`POST /__upload__/path/to/file`
- Simple stats (`/__stats__`), health check (`/__health__`), and speed test (`/__speed__?bytes=...`)
- Optional CORS (including preflight OPTIONS)
- Optional cache disable
- Optional serving of precompressed `.gz` assets when safe
- TLS (PEM cert and key)
- Rich CLI built on click and rich-click
- Cross-platform (Linux/macOS/Windows), Python 3.9+

## Install

```bash
pip install blazeserve
```

## Quick start

```bash
blaze serve .
```

Open your browser to:

- Local: `http://localhost:8000/`
- LAN: shown in the startup banner

## CLI

### `serve`

```
blaze serve [PATH]

Options:
  --host TEXT                      Bind address. [default: 0.0.0.0]
  -p, --port INTEGER               Port. [default: 8000]
  --single PATH                    Serve exactly this file.
  --no-listing                     Disable directory listing.
  --chunk-mb INTEGER               mmap/read window size. [4..4096] [default: 128]
  --sock-sndbuf-mb INTEGER         SO_SNDBUF (MB). [1..2048] [default: 64]
  --timeout INTEGER                Per-connection timeout (s). [60..86400]
  --rate-mbps FLOAT                Throttle to MB/s.
  --auth USER:PASS                 Enable HTTP Basic Auth.
  --auth-env NAME                  Read USER:PASS from env var NAME.
  --tls-cert PATH                  TLS certificate (PEM).
  --tls-key PATH                   TLS private key (PEM).
  --cors / --no-cors               Enable CORS. [default: no-cors]
  --cors-origin TEXT               CORS allow origin. [default: *]
  --no-cache                       Disable HTTP caching.
  --index TEXT                     Extra index filenames (repeatable).
  --backlog INTEGER                Listen backlog. [default: 4096]
  --precompress / --no-precompress Serve .gz when safe. [default: precompress]
  --max-upload-mb INTEGER          Max upload size (0 = unlimited). [default: 0]
  --open                           Open the URL in a browser at start.
  -v, --verbose                    Verbose startup banner.
  -h, --help                       Show help.
```

### `send`

```
blaze send FILE

Options:
  --host TEXT
  -p, --port INTEGER
  --rate-mbps FLOAT
  --auth USER:PASS
  --auth-env NAME
  --tls-cert PATH
  --tls-key PATH
  --cors / --no-cors
  --cors-origin TEXT
  --no-cache
  --backlog INTEGER
  --precompress / --no-precompress
  --max-upload-mb INTEGER
```

### Other commands

```
blaze checksum [FILES...]     Print SHA256 checksums.
blaze version                 Show version.
```

## Endpoints

- `GET /__health__` -> `{"status":"ok"}`
- `GET /__stats__` -> `{"bytes_sent": <int>}`
- `GET /__speed__?bytes=104857600` -> streams zeros for client speed testing
- `GET /__zip__?path=relative/or/absolute/path` -> streams a ZIP
- `PUT|POST /__upload__/path/to/file` -> saves request body to disk (requires Content-Length)

## Examples

Share a directory on port 8080 with CORS:

```bash
blaze serve /srv/files -p 8080 --cors --cors-origin https://example.com
```

Serve one file over TLS:

```bash
blaze serve --single ./movie.mp4 --tls-cert cert.pem --tls-key key.pem
```

Limit download rate to 200 MB/s:

```bash
blaze serve . --rate-mbps 200
```

Upload a file:

```bash
curl -T ./big.iso http://host:8000/__upload__/uploads/big.iso
```

Stream a zip of a folder:

```bash
curl -L "http://host:8000/__zip__?path=./photos" -o photos.zip
```

## Auth

Enable Basic Auth:

```bash
blaze serve . --auth user:pass
# or from env
export BLAZE_AUTH=user:pass
blaze serve . --auth-env BLAZE_AUTH
```

## Notes

- If `--no-cache` is set, responses use `Cache-Control: no-store`.
- Precompressed `.gz` files are served only for non-range requests to keep range semantics correct.
- In single-file mode, listing is disabled and the fast path is favored.

## Systemd

```
[Unit]
Description=BlazeServe
After=network.target

[Service]
ExecStart=/usr/bin/blaze serve /srv/downloads --port 8080 --rate-mbps 200 --cors
Restart=on-failure
User=www-data
Group=www-data
WorkingDirectory=/srv/downloads

[Install]
WantedBy=multi-user.target
```

## Docker

```
FROM python:3.12-slim
RUN pip install --no-cache-dir blazeserve
WORKDIR /data
EXPOSE 8000
CMD ["blaze", "serve", ".", "--host", "0.0.0.0", "--port", "8000"]
```

## License

MIT. See [LICENSE](./LICENSE).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "blazeserve",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "http, file-server, range, resume, download, cli, rich, click, cors, zip, throttle",
    "author": "Jaydeep Solanki",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/7f/aa/2fe0c5c852de32ab9cc4d894a9f287a090769dc4535c82b7ddea6d2546df/blazeserve-0.1.0.tar.gz",
    "platform": null,
    "description": "# BlazeServe\n\nFast, dependable HTTP file server for sharing files and folders. Supports byte-range and multi-range downloads, TLS, Basic Auth, throttling, uploads, streaming ZIP, optional CORS, and a modern, colorful CLI.\n\n## Features\n\n- Static file serving over HTTP/1.1 with strong ETag, Last-Modified, and If-Range\n- Range and multi-range responses\n- Zero-copy sendfile fast path, windowed mmap, and buffered fallback\n- Per-connection rate limiting\n- Optional directory listing with automatic index.html\n- One-file mode for quick shares\n- Streaming ZIP for files or directories (`/__zip__?path=...`)\n- Uploads via `PUT`/`POST /__upload__/path/to/file`\n- Simple stats (`/__stats__`), health check (`/__health__`), and speed test (`/__speed__?bytes=...`)\n- Optional CORS (including preflight OPTIONS)\n- Optional cache disable\n- Optional serving of precompressed `.gz` assets when safe\n- TLS (PEM cert and key)\n- Rich CLI built on click and rich-click\n- Cross-platform (Linux/macOS/Windows), Python 3.9+\n\n## Install\n\n```bash\npip install blazeserve\n```\n\n## Quick start\n\n```bash\nblaze serve .\n```\n\nOpen your browser to:\n\n- Local: `http://localhost:8000/`\n- LAN: shown in the startup banner\n\n## CLI\n\n### `serve`\n\n```\nblaze serve [PATH]\n\nOptions:\n  --host TEXT                      Bind address. [default: 0.0.0.0]\n  -p, --port INTEGER               Port. [default: 8000]\n  --single PATH                    Serve exactly this file.\n  --no-listing                     Disable directory listing.\n  --chunk-mb INTEGER               mmap/read window size. [4..4096] [default: 128]\n  --sock-sndbuf-mb INTEGER         SO_SNDBUF (MB). [1..2048] [default: 64]\n  --timeout INTEGER                Per-connection timeout (s). [60..86400]\n  --rate-mbps FLOAT                Throttle to MB/s.\n  --auth USER:PASS                 Enable HTTP Basic Auth.\n  --auth-env NAME                  Read USER:PASS from env var NAME.\n  --tls-cert PATH                  TLS certificate (PEM).\n  --tls-key PATH                   TLS private key (PEM).\n  --cors / --no-cors               Enable CORS. [default: no-cors]\n  --cors-origin TEXT               CORS allow origin. [default: *]\n  --no-cache                       Disable HTTP caching.\n  --index TEXT                     Extra index filenames (repeatable).\n  --backlog INTEGER                Listen backlog. [default: 4096]\n  --precompress / --no-precompress Serve .gz when safe. [default: precompress]\n  --max-upload-mb INTEGER          Max upload size (0 = unlimited). [default: 0]\n  --open                           Open the URL in a browser at start.\n  -v, --verbose                    Verbose startup banner.\n  -h, --help                       Show help.\n```\n\n### `send`\n\n```\nblaze send FILE\n\nOptions:\n  --host TEXT\n  -p, --port INTEGER\n  --rate-mbps FLOAT\n  --auth USER:PASS\n  --auth-env NAME\n  --tls-cert PATH\n  --tls-key PATH\n  --cors / --no-cors\n  --cors-origin TEXT\n  --no-cache\n  --backlog INTEGER\n  --precompress / --no-precompress\n  --max-upload-mb INTEGER\n```\n\n### Other commands\n\n```\nblaze checksum [FILES...]     Print SHA256 checksums.\nblaze version                 Show version.\n```\n\n## Endpoints\n\n- `GET /__health__` -> `{\"status\":\"ok\"}`\n- `GET /__stats__` -> `{\"bytes_sent\": <int>}`\n- `GET /__speed__?bytes=104857600` -> streams zeros for client speed testing\n- `GET /__zip__?path=relative/or/absolute/path` -> streams a ZIP\n- `PUT|POST /__upload__/path/to/file` -> saves request body to disk (requires Content-Length)\n\n## Examples\n\nShare a directory on port 8080 with CORS:\n\n```bash\nblaze serve /srv/files -p 8080 --cors --cors-origin https://example.com\n```\n\nServe one file over TLS:\n\n```bash\nblaze serve --single ./movie.mp4 --tls-cert cert.pem --tls-key key.pem\n```\n\nLimit download rate to 200 MB/s:\n\n```bash\nblaze serve . --rate-mbps 200\n```\n\nUpload a file:\n\n```bash\ncurl -T ./big.iso http://host:8000/__upload__/uploads/big.iso\n```\n\nStream a zip of a folder:\n\n```bash\ncurl -L \"http://host:8000/__zip__?path=./photos\" -o photos.zip\n```\n\n## Auth\n\nEnable Basic Auth:\n\n```bash\nblaze serve . --auth user:pass\n# or from env\nexport BLAZE_AUTH=user:pass\nblaze serve . --auth-env BLAZE_AUTH\n```\n\n## Notes\n\n- If `--no-cache` is set, responses use `Cache-Control: no-store`.\n- Precompressed `.gz` files are served only for non-range requests to keep range semantics correct.\n- In single-file mode, listing is disabled and the fast path is favored.\n\n## Systemd\n\n```\n[Unit]\nDescription=BlazeServe\nAfter=network.target\n\n[Service]\nExecStart=/usr/bin/blaze serve /srv/downloads --port 8080 --rate-mbps 200 --cors\nRestart=on-failure\nUser=www-data\nGroup=www-data\nWorkingDirectory=/srv/downloads\n\n[Install]\nWantedBy=multi-user.target\n```\n\n## Docker\n\n```\nFROM python:3.12-slim\nRUN pip install --no-cache-dir blazeserve\nWORKDIR /data\nEXPOSE 8000\nCMD [\"blaze\", \"serve\", \".\", \"--host\", \"0.0.0.0\", \"--port\", \"8000\"]\n```\n\n## License\n\nMIT. See [LICENSE](./LICENSE).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Fast, dependable HTTP file server for sharing files and folders \u2014 supports byte-range/multi-range downloads, TLS, Basic Auth, throttling, uploads, streaming ZIP, CORS, and a polished CLI.",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/whoisjayd/blazeserve",
        "Issues": "https://github.com/whoisjayd/blazeserve/issues",
        "Repository": "https://github.com/whoisjayd/blazeserve.git"
    },
    "split_keywords": [
        "http",
        " file-server",
        " range",
        " resume",
        " download",
        " cli",
        " rich",
        " click",
        " cors",
        " zip",
        " throttle"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9c61a99e0b1b85fc8839cdb4b7c18a2bcd04941d4dd5ae2d2e6190df11cfe1e5",
                "md5": "33823c8b1e110868882613f672930df3",
                "sha256": "eca5d3a7e0caaf8ffd631a881a02e1d30795ab09058c5cdfd88508c5b3e705fc"
            },
            "downloads": -1,
            "filename": "blazeserve-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "33823c8b1e110868882613f672930df3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 16310,
            "upload_time": "2025-10-10T20:52:49",
            "upload_time_iso_8601": "2025-10-10T20:52:49.911351Z",
            "url": "https://files.pythonhosted.org/packages/9c/61/a99e0b1b85fc8839cdb4b7c18a2bcd04941d4dd5ae2d2e6190df11cfe1e5/blazeserve-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7faa2fe0c5c852de32ab9cc4d894a9f287a090769dc4535c82b7ddea6d2546df",
                "md5": "69b9b2e6c1962515b2044d7d5085c6e0",
                "sha256": "10134a77273222d1b94171784697ce9ecdbf20f2fe59c8eab393feb97b10ba02"
            },
            "downloads": -1,
            "filename": "blazeserve-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "69b9b2e6c1962515b2044d7d5085c6e0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 17349,
            "upload_time": "2025-10-10T20:52:51",
            "upload_time_iso_8601": "2025-10-10T20:52:51.187066Z",
            "url": "https://files.pythonhosted.org/packages/7f/aa/2fe0c5c852de32ab9cc4d894a9f287a090769dc4535c82b7ddea6d2546df/blazeserve-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-10 20:52:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "whoisjayd",
    "github_project": "blazeserve",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "blazeserve"
}
        
Elapsed time: 1.33322s