File size: 454 Bytes
b1fdcc2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from fastapi import FastAPI
from fastapi.responses import FileResponse
from urllib.parse import unquote

import os

app = FastAPI()


@app.get("/streaming/{path:path}")
async def serve_streaming(path: str):
    # Decode URL-encoded characters
    decoded_path = unquote(path)
    return FileResponse(decoded_path, filename=os.path.basename(decoded_path))


if __name__ == "__main__":
    import uvicorn

    uvicorn.run(app, host="127.0.0.1", port=8000)