MCPcopy Index your code
hub / github.com/vastsa/FileCodeBox / download_file

Method download_file

apps/admin/services.py:1429–1436  ·  view source on GitHub ↗
(self, file_id: int)

Source from the content-addressed store, hash-verified

1427 return sort_map.get(sort_by)
1428
1429 async def download_file(self, file_id: int):
1430 file_code = await FileCodes.filter(id=file_id).first()
1431 if not file_code:
1432 raise HTTPException(status_code=404, detail="文件不存在")
1433 if file_code.text:
1434 return APIResponse(detail=file_code.text)
1435 else:
1436 return await self.file_storage.get_file_response(file_code)
1437
1438 async def preview_file(self, file_id: int, max_chars: int = 4000):
1439 max_chars = min(max(max_chars, 1), 20000)

Callers 1

file_downloadFunction · 0.80

Calls 4

APIResponseClass · 0.90
firstMethod · 0.45
filterMethod · 0.45
get_file_responseMethod · 0.45

Tested by

no test coverage detected