Streaming Response
say it: “STREE-ming rih-SPONS” /ˈstrimɪŋ rɪˈspɒns/
Sends data in pieces as it is produced.
What is Streaming Response?
A StreamingResponse sends data in pieces as it is produced, such as a large file or AI-generated text, instead of all at once.
async def count():
for n in range(10):
yield f'{n}\n'
@app.get('/count')
def stream():
return StreamingResponse(count(), media_type='text/plain')
Level: Freelancer · More FastAPI terms at this level
Updated