Merge pull request #733 from ashleysommer/file_stream

Add file_stream response handler
This commit is contained in:
Raphael Deem
2017-05-19 16:48:12 -07:00
committed by GitHub
4 changed files with 174 additions and 2 deletions

View File

@@ -60,6 +60,16 @@ async def index(request):
return response.stream(streaming_fn, content_type='text/plain')
```
## File Streaming
For large files, a combination of File and Streaming above
```python
from sanic import response
@app.route('/big_file.png')
async def handle_request(request):
return await response.file_stream('/srv/www/whatever.png')
```
## Redirect
```python