blazeserve 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Jaydeep Solanki
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,221 @@
1
+ Metadata-Version: 2.4
2
+ Name: blazeserve
3
+ Version: 0.1.0
4
+ Summary: Fast, 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.
5
+ Author: Jaydeep Solanki
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/whoisjayd/blazeserve
8
+ Project-URL: Repository, https://github.com/whoisjayd/blazeserve.git
9
+ Project-URL: Issues, https://github.com/whoisjayd/blazeserve/issues
10
+ Keywords: http,file-server,range,resume,download,cli,rich,click,cors,zip,throttle
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: License :: OSI Approved :: MIT License
19
+ Classifier: Operating System :: OS Independent
20
+ Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
21
+ Classifier: Topic :: System :: Networking
22
+ Requires-Python: >=3.9
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: click>=8.1
26
+ Requires-Dist: rich>=13.0.0
27
+ Requires-Dist: rich-click>=1.8.0
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=8.0; extra == "dev"
30
+ Requires-Dist: mypy>=1.7; extra == "dev"
31
+ Requires-Dist: ruff>=0.5; extra == "dev"
32
+ Requires-Dist: types-click>=7.1.8; extra == "dev"
33
+ Dynamic: license-file
34
+
35
+ # BlazeServe
36
+
37
+ 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.
38
+
39
+ ## Features
40
+
41
+ - Static file serving over HTTP/1.1 with strong ETag, Last-Modified, and If-Range
42
+ - Range and multi-range responses
43
+ - Zero-copy sendfile fast path, windowed mmap, and buffered fallback
44
+ - Per-connection rate limiting
45
+ - Optional directory listing with automatic index.html
46
+ - One-file mode for quick shares
47
+ - Streaming ZIP for files or directories (`/__zip__?path=...`)
48
+ - Uploads via `PUT`/`POST /__upload__/path/to/file`
49
+ - Simple stats (`/__stats__`), health check (`/__health__`), and speed test (`/__speed__?bytes=...`)
50
+ - Optional CORS (including preflight OPTIONS)
51
+ - Optional cache disable
52
+ - Optional serving of precompressed `.gz` assets when safe
53
+ - TLS (PEM cert and key)
54
+ - Rich CLI built on click and rich-click
55
+ - Cross-platform (Linux/macOS/Windows), Python 3.9+
56
+
57
+ ## Install
58
+
59
+ ```bash
60
+ pip install blazeserve
61
+ ```
62
+
63
+ ## Quick start
64
+
65
+ ```bash
66
+ blaze serve .
67
+ ```
68
+
69
+ Open your browser to:
70
+
71
+ - Local: `http://localhost:8000/`
72
+ - LAN: shown in the startup banner
73
+
74
+ ## CLI
75
+
76
+ ### `serve`
77
+
78
+ ```
79
+ blaze serve [PATH]
80
+
81
+ Options:
82
+ --host TEXT Bind address. [default: 0.0.0.0]
83
+ -p, --port INTEGER Port. [default: 8000]
84
+ --single PATH Serve exactly this file.
85
+ --no-listing Disable directory listing.
86
+ --chunk-mb INTEGER mmap/read window size. [4..4096] [default: 128]
87
+ --sock-sndbuf-mb INTEGER SO_SNDBUF (MB). [1..2048] [default: 64]
88
+ --timeout INTEGER Per-connection timeout (s). [60..86400]
89
+ --rate-mbps FLOAT Throttle to MB/s.
90
+ --auth USER:PASS Enable HTTP Basic Auth.
91
+ --auth-env NAME Read USER:PASS from env var NAME.
92
+ --tls-cert PATH TLS certificate (PEM).
93
+ --tls-key PATH TLS private key (PEM).
94
+ --cors / --no-cors Enable CORS. [default: no-cors]
95
+ --cors-origin TEXT CORS allow origin. [default: *]
96
+ --no-cache Disable HTTP caching.
97
+ --index TEXT Extra index filenames (repeatable).
98
+ --backlog INTEGER Listen backlog. [default: 4096]
99
+ --precompress / --no-precompress Serve .gz when safe. [default: precompress]
100
+ --max-upload-mb INTEGER Max upload size (0 = unlimited). [default: 0]
101
+ --open Open the URL in a browser at start.
102
+ -v, --verbose Verbose startup banner.
103
+ -h, --help Show help.
104
+ ```
105
+
106
+ ### `send`
107
+
108
+ ```
109
+ blaze send FILE
110
+
111
+ Options:
112
+ --host TEXT
113
+ -p, --port INTEGER
114
+ --rate-mbps FLOAT
115
+ --auth USER:PASS
116
+ --auth-env NAME
117
+ --tls-cert PATH
118
+ --tls-key PATH
119
+ --cors / --no-cors
120
+ --cors-origin TEXT
121
+ --no-cache
122
+ --backlog INTEGER
123
+ --precompress / --no-precompress
124
+ --max-upload-mb INTEGER
125
+ ```
126
+
127
+ ### Other commands
128
+
129
+ ```
130
+ blaze checksum [FILES...] Print SHA256 checksums.
131
+ blaze version Show version.
132
+ ```
133
+
134
+ ## Endpoints
135
+
136
+ - `GET /__health__` -> `{"status":"ok"}`
137
+ - `GET /__stats__` -> `{"bytes_sent": <int>}`
138
+ - `GET /__speed__?bytes=104857600` -> streams zeros for client speed testing
139
+ - `GET /__zip__?path=relative/or/absolute/path` -> streams a ZIP
140
+ - `PUT|POST /__upload__/path/to/file` -> saves request body to disk (requires Content-Length)
141
+
142
+ ## Examples
143
+
144
+ Share a directory on port 8080 with CORS:
145
+
146
+ ```bash
147
+ blaze serve /srv/files -p 8080 --cors --cors-origin https://example.com
148
+ ```
149
+
150
+ Serve one file over TLS:
151
+
152
+ ```bash
153
+ blaze serve --single ./movie.mp4 --tls-cert cert.pem --tls-key key.pem
154
+ ```
155
+
156
+ Limit download rate to 200 MB/s:
157
+
158
+ ```bash
159
+ blaze serve . --rate-mbps 200
160
+ ```
161
+
162
+ Upload a file:
163
+
164
+ ```bash
165
+ curl -T ./big.iso http://host:8000/__upload__/uploads/big.iso
166
+ ```
167
+
168
+ Stream a zip of a folder:
169
+
170
+ ```bash
171
+ curl -L "http://host:8000/__zip__?path=./photos" -o photos.zip
172
+ ```
173
+
174
+ ## Auth
175
+
176
+ Enable Basic Auth:
177
+
178
+ ```bash
179
+ blaze serve . --auth user:pass
180
+ # or from env
181
+ export BLAZE_AUTH=user:pass
182
+ blaze serve . --auth-env BLAZE_AUTH
183
+ ```
184
+
185
+ ## Notes
186
+
187
+ - If `--no-cache` is set, responses use `Cache-Control: no-store`.
188
+ - Precompressed `.gz` files are served only for non-range requests to keep range semantics correct.
189
+ - In single-file mode, listing is disabled and the fast path is favored.
190
+
191
+ ## Systemd
192
+
193
+ ```
194
+ [Unit]
195
+ Description=BlazeServe
196
+ After=network.target
197
+
198
+ [Service]
199
+ ExecStart=/usr/bin/blaze serve /srv/downloads --port 8080 --rate-mbps 200 --cors
200
+ Restart=on-failure
201
+ User=www-data
202
+ Group=www-data
203
+ WorkingDirectory=/srv/downloads
204
+
205
+ [Install]
206
+ WantedBy=multi-user.target
207
+ ```
208
+
209
+ ## Docker
210
+
211
+ ```
212
+ FROM python:3.12-slim
213
+ RUN pip install --no-cache-dir blazeserve
214
+ WORKDIR /data
215
+ EXPOSE 8000
216
+ CMD ["blaze", "serve", ".", "--host", "0.0.0.0", "--port", "8000"]
217
+ ```
218
+
219
+ ## License
220
+
221
+ MIT. See [LICENSE](./LICENSE).
@@ -0,0 +1,187 @@
1
+ # BlazeServe
2
+
3
+ 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.
4
+
5
+ ## Features
6
+
7
+ - Static file serving over HTTP/1.1 with strong ETag, Last-Modified, and If-Range
8
+ - Range and multi-range responses
9
+ - Zero-copy sendfile fast path, windowed mmap, and buffered fallback
10
+ - Per-connection rate limiting
11
+ - Optional directory listing with automatic index.html
12
+ - One-file mode for quick shares
13
+ - Streaming ZIP for files or directories (`/__zip__?path=...`)
14
+ - Uploads via `PUT`/`POST /__upload__/path/to/file`
15
+ - Simple stats (`/__stats__`), health check (`/__health__`), and speed test (`/__speed__?bytes=...`)
16
+ - Optional CORS (including preflight OPTIONS)
17
+ - Optional cache disable
18
+ - Optional serving of precompressed `.gz` assets when safe
19
+ - TLS (PEM cert and key)
20
+ - Rich CLI built on click and rich-click
21
+ - Cross-platform (Linux/macOS/Windows), Python 3.9+
22
+
23
+ ## Install
24
+
25
+ ```bash
26
+ pip install blazeserve
27
+ ```
28
+
29
+ ## Quick start
30
+
31
+ ```bash
32
+ blaze serve .
33
+ ```
34
+
35
+ Open your browser to:
36
+
37
+ - Local: `http://localhost:8000/`
38
+ - LAN: shown in the startup banner
39
+
40
+ ## CLI
41
+
42
+ ### `serve`
43
+
44
+ ```
45
+ blaze serve [PATH]
46
+
47
+ Options:
48
+ --host TEXT Bind address. [default: 0.0.0.0]
49
+ -p, --port INTEGER Port. [default: 8000]
50
+ --single PATH Serve exactly this file.
51
+ --no-listing Disable directory listing.
52
+ --chunk-mb INTEGER mmap/read window size. [4..4096] [default: 128]
53
+ --sock-sndbuf-mb INTEGER SO_SNDBUF (MB). [1..2048] [default: 64]
54
+ --timeout INTEGER Per-connection timeout (s). [60..86400]
55
+ --rate-mbps FLOAT Throttle to MB/s.
56
+ --auth USER:PASS Enable HTTP Basic Auth.
57
+ --auth-env NAME Read USER:PASS from env var NAME.
58
+ --tls-cert PATH TLS certificate (PEM).
59
+ --tls-key PATH TLS private key (PEM).
60
+ --cors / --no-cors Enable CORS. [default: no-cors]
61
+ --cors-origin TEXT CORS allow origin. [default: *]
62
+ --no-cache Disable HTTP caching.
63
+ --index TEXT Extra index filenames (repeatable).
64
+ --backlog INTEGER Listen backlog. [default: 4096]
65
+ --precompress / --no-precompress Serve .gz when safe. [default: precompress]
66
+ --max-upload-mb INTEGER Max upload size (0 = unlimited). [default: 0]
67
+ --open Open the URL in a browser at start.
68
+ -v, --verbose Verbose startup banner.
69
+ -h, --help Show help.
70
+ ```
71
+
72
+ ### `send`
73
+
74
+ ```
75
+ blaze send FILE
76
+
77
+ Options:
78
+ --host TEXT
79
+ -p, --port INTEGER
80
+ --rate-mbps FLOAT
81
+ --auth USER:PASS
82
+ --auth-env NAME
83
+ --tls-cert PATH
84
+ --tls-key PATH
85
+ --cors / --no-cors
86
+ --cors-origin TEXT
87
+ --no-cache
88
+ --backlog INTEGER
89
+ --precompress / --no-precompress
90
+ --max-upload-mb INTEGER
91
+ ```
92
+
93
+ ### Other commands
94
+
95
+ ```
96
+ blaze checksum [FILES...] Print SHA256 checksums.
97
+ blaze version Show version.
98
+ ```
99
+
100
+ ## Endpoints
101
+
102
+ - `GET /__health__` -> `{"status":"ok"}`
103
+ - `GET /__stats__` -> `{"bytes_sent": <int>}`
104
+ - `GET /__speed__?bytes=104857600` -> streams zeros for client speed testing
105
+ - `GET /__zip__?path=relative/or/absolute/path` -> streams a ZIP
106
+ - `PUT|POST /__upload__/path/to/file` -> saves request body to disk (requires Content-Length)
107
+
108
+ ## Examples
109
+
110
+ Share a directory on port 8080 with CORS:
111
+
112
+ ```bash
113
+ blaze serve /srv/files -p 8080 --cors --cors-origin https://example.com
114
+ ```
115
+
116
+ Serve one file over TLS:
117
+
118
+ ```bash
119
+ blaze serve --single ./movie.mp4 --tls-cert cert.pem --tls-key key.pem
120
+ ```
121
+
122
+ Limit download rate to 200 MB/s:
123
+
124
+ ```bash
125
+ blaze serve . --rate-mbps 200
126
+ ```
127
+
128
+ Upload a file:
129
+
130
+ ```bash
131
+ curl -T ./big.iso http://host:8000/__upload__/uploads/big.iso
132
+ ```
133
+
134
+ Stream a zip of a folder:
135
+
136
+ ```bash
137
+ curl -L "http://host:8000/__zip__?path=./photos" -o photos.zip
138
+ ```
139
+
140
+ ## Auth
141
+
142
+ Enable Basic Auth:
143
+
144
+ ```bash
145
+ blaze serve . --auth user:pass
146
+ # or from env
147
+ export BLAZE_AUTH=user:pass
148
+ blaze serve . --auth-env BLAZE_AUTH
149
+ ```
150
+
151
+ ## Notes
152
+
153
+ - If `--no-cache` is set, responses use `Cache-Control: no-store`.
154
+ - Precompressed `.gz` files are served only for non-range requests to keep range semantics correct.
155
+ - In single-file mode, listing is disabled and the fast path is favored.
156
+
157
+ ## Systemd
158
+
159
+ ```
160
+ [Unit]
161
+ Description=BlazeServe
162
+ After=network.target
163
+
164
+ [Service]
165
+ ExecStart=/usr/bin/blaze serve /srv/downloads --port 8080 --rate-mbps 200 --cors
166
+ Restart=on-failure
167
+ User=www-data
168
+ Group=www-data
169
+ WorkingDirectory=/srv/downloads
170
+
171
+ [Install]
172
+ WantedBy=multi-user.target
173
+ ```
174
+
175
+ ## Docker
176
+
177
+ ```
178
+ FROM python:3.12-slim
179
+ RUN pip install --no-cache-dir blazeserve
180
+ WORKDIR /data
181
+ EXPOSE 8000
182
+ CMD ["blaze", "serve", ".", "--host", "0.0.0.0", "--port", "8000"]
183
+ ```
184
+
185
+ ## License
186
+
187
+ MIT. See [LICENSE](./LICENSE).
@@ -0,0 +1,2 @@
1
+ __all__ = ["__version__"]
2
+ __version__ = "0.1.0"