You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add something like Flask's send_file to Werkzeug #265
Flask's send_file takes a file name or object and returns a response that can be used to send this file to the client. Werkzeug doesn't have any analogue -- SharedDataMiddleware is the closest, but its API is better suited to serving directories and it doesn't have many of send_file's useful options.
Flask tends to build on Werkzeug, but that's not the case with send_file -- it's lower-level than most of Flask. It'd be better if Werkzeug contained the base functionality and Flask just provided the framework integration (like send_from_directory and get_send_file_max_age). And perhaps SharedDataMiddleware could use this common base too (right now they both have to deal with generating etags, etc).
@pgjones pointed out that we should make Werkzeug's send_file implementation sans-io, so that it can be used with ASGI. Maybe he can elaborate on a design, but we'll need something where we can pass in data incrementally rather than passing an open file.
Activity
amigrave commentedon Sep 2, 2014
Indeed !
I'm used to @mitsuhiko 's style that emphasis reusability but unfortunately it seems he missed that one.
davidism commentedon Apr 12, 2020
@pgjones pointed out that we should make Werkzeug's
send_fileimplementation sans-io, so that it can be used with ASGI. Maybe he can elaborate on a design, but we'll need something where we can pass in data incrementally rather than passing an open file.roeeyn commentedon Jun 15, 2020
I will be working in this issue 😄