FastAPI Server for Tus Protocol
A file upload server of the tus resumable upload protocol is implemented on FastAPI framework.
Thanks to tusd, it provides great ideas and a sensible design pattern to implement Tus protocol to support multiple backend storage implementations.
Features:
- Basic operations to support Core Protocol such as HEAD, POST, PATCH, DELETE
- Creation With Upload
- Checksum such as md5
- Expiration
- Concatenation
- File storage
- S3 storage
Getting started
Import TusRouter to your application,
from fastapi import FastAPI
from fastapi_tusd import TusRouter
app = FastAPI()
# `store_dir`: the folder to store uploaded files
# `location`: the API endpoint to serve, like `http://127.0.0.1:8000/files` or relative path `files` (TODO: induced from `prefix` in default)
app.include_router(TusRouter(store_dir="./files", location="/files"), prefix="/files")
Then the tus upload endpoints will be served at http://127.0.0.1:8000/files, more information is available at http://127.0.0.1:8000/docs
Examples
There is a simple example with a web file upload client supporting for Tus protocol, thanks to Uppy!
Enter the example/ folder, and run(pip install uvicornif nouvicorn`!)
uvicorn app_tusd:app --reload
Then visit https://127.0.0.1:8000/upload.thml
References
GitHub - tus/tus-resumable-upload-protocol: Open Protocol for Resumable File Uploads
Release files for fastapi-tusd 0.100.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastapi-tusd-0.100.2.tar.gz | 9.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastapi_tusd-0.100.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.5 kB
Release files / fastapi-tusd-0.100.2.tar.gz
| Download URL | fastapi-tusd-0.100.2.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
126da8d8558a7986db736026556f95c7ee481dc762a48ddb8f7bbe367ceb9947
|
|
BLAKE2b-256 checksum How to use checksums |
6cee4f39541ae2d2fcbc0fb0655f08b60609f6f82403ad792d5487ee263c7f68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.9
|
Release files / fastapi_tusd-0.100.2-py3-none-any.whl
| Download URL | fastapi_tusd-0.100.2-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f7f2131dd3875ca6e524fb24a012853613f3ba8b03c545db17794e1930ed9989
|
|
BLAKE2b-256 checksum How to use checksums |
a5388cdbba13ba19b5e45420cc6d43be1d6ec820447197c422853b472a928574
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.9
|