# FastAPI Server for Tus Protocol
A file upload server of the tus resumable upload protocol is implemented on **FastAPI** framework.
Thanks to [tusd](https://github.com/tus/tusd), it provides great ideas and a sensible design pattern to implement `Tus` protocol to support multiple backend storage implementations.
**Features**:
- [x] Basic operations to support Core Protocol such as **HEAD**, **POST**, **PATCH**, **DELETE**
- [x] Creation With Upload
- [ ] Checksum such as md5
- [ ] Expiration
- [ ] Concatenation
- [x] File storage
- [ ] S3 storage
## Getting started
Import `TusRouter` to your application,
```py title=main.py
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 `uvicorn` if no `uvicorn`!)
```sh
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](https://github.com/tus/tus-resumable-upload-protocol)
Raw data
{
"_id": null,
"home_page": "https://github.com/liviaerxin/fastapi-tusd",
"name": "fastapi-tusd",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "fastapi-tusd",
"author": "Frank",
"author_email": "1yue8haogaoqi@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/6c/ee/4f39541ae2d2fcbc0fb0655f08b60609f6f82403ad792d5487ee263c7f68/fastapi-tusd-0.100.2.tar.gz",
"platform": null,
"description": "# FastAPI Server for Tus Protocol\n\nA file upload server of the tus resumable upload protocol is implemented on **FastAPI** framework. \n\nThanks to [tusd](https://github.com/tus/tusd), it provides great ideas and a sensible design pattern to implement `Tus` protocol to support multiple backend storage implementations.\n\n**Features**:\n\n- [x] Basic operations to support Core Protocol such as **HEAD**, **POST**, **PATCH**, **DELETE**\n - [x] Creation With Upload\n - [ ] Checksum such as md5\n - [ ] Expiration\n - [ ] Concatenation\n- [x] File storage\n- [ ] S3 storage\n\n\n## Getting started\n\nImport `TusRouter` to your application,\n\n```py title=main.py\nfrom fastapi import FastAPI\nfrom fastapi_tusd import TusRouter\n\napp = FastAPI()\n\n# `store_dir`: the folder to store uploaded files\n# `location`: the API endpoint to serve, like `http://127.0.0.1:8000/files` or relative path `files` (TODO: induced from `prefix` in default)\napp.include_router(TusRouter(store_dir=\"./files\", location=\"/files\"), prefix=\"/files\")\n```\n\nThen 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`\n\n### Examples\n\nThere is a simple example with a web file upload client supporting for `Tus` protocol, thanks to `Uppy`!\n\nEnter the `example/` folder, and run(`pip install `uvicorn` if no `uvicorn`!)\n\n```sh\nuvicorn app_tusd:app --reload\n```\n\nThen visit `https://127.0.0.1:8000/upload.thml`\n\n## References\n\n[GitHub - tus/tus-resumable-upload-protocol: Open Protocol for Resumable File Uploads](https://github.com/tus/tus-resumable-upload-protocol)\n",
"bugtrack_url": null,
"license": "MIT license",
"summary": "FastAPI extention implementing the tus server",
"version": "0.100.2",
"project_urls": {
"Homepage": "https://github.com/liviaerxin/fastapi-tusd"
},
"split_keywords": [
"fastapi-tusd"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a5388cdbba13ba19b5e45420cc6d43be1d6ec820447197c422853b472a928574",
"md5": "385fa8fb94052d287408252679c0d5fb",
"sha256": "f7f2131dd3875ca6e524fb24a012853613f3ba8b03c545db17794e1930ed9989"
},
"downloads": -1,
"filename": "fastapi_tusd-0.100.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "385fa8fb94052d287408252679c0d5fb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 7996,
"upload_time": "2024-05-10T09:22:03",
"upload_time_iso_8601": "2024-05-10T09:22:03.859479Z",
"url": "https://files.pythonhosted.org/packages/a5/38/8cdbba13ba19b5e45420cc6d43be1d6ec820447197c422853b472a928574/fastapi_tusd-0.100.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6cee4f39541ae2d2fcbc0fb0655f08b60609f6f82403ad792d5487ee263c7f68",
"md5": "0187a25b2cd668e5efc04cc4f95ceb94",
"sha256": "126da8d8558a7986db736026556f95c7ee481dc762a48ddb8f7bbe367ceb9947"
},
"downloads": -1,
"filename": "fastapi-tusd-0.100.2.tar.gz",
"has_sig": false,
"md5_digest": "0187a25b2cd668e5efc04cc4f95ceb94",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 9514,
"upload_time": "2024-05-10T09:22:05",
"upload_time_iso_8601": "2024-05-10T09:22:05.636134Z",
"url": "https://files.pythonhosted.org/packages/6c/ee/4f39541ae2d2fcbc0fb0655f08b60609f6f82403ad792d5487ee263c7f68/fastapi-tusd-0.100.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-10 09:22:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "liviaerxin",
"github_project": "fastapi-tusd",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "fastapi-tusd"
}