From a0d7f37ce81645c8c254ac7fca12e2429260d004 Mon Sep 17 00:00:00 2001 From: carlosribas Date: Wed, 17 Jul 2024 16:55:01 +0100 Subject: [PATCH] Bug fix --- app/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/main.py b/app/main.py index 3f4bf23..0f3c1a4 100644 --- a/app/main.py +++ b/app/main.py @@ -122,10 +122,10 @@ def download_file(task_id: str, data_type: str): raise HTTPException(status_code=202, detail="Task is still processing") -def stream_file(file_path: str, filename: str): +async def stream_file(file_path: str, filename: str): async def read_file(): async with aiofiles.open(file_path, "rb") as file: - while chunk := file.read(16384): # Read in 16KB chunks + while chunk := await file.read(16384): # Read in 16KB chunks yield chunk file_size = os.path.getsize(file_path)