Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add something like Flask's send_file to Werkzeug #265

Closed
TomiBelan opened this issue Feb 14, 2013 · 3 comments · Fixed by #1850
Closed

Add something like Flask's send_file to Werkzeug #265

TomiBelan opened this issue Feb 14, 2013 · 3 comments · Fixed by #1850
Milestone

Comments

@TomiBelan
Copy link
Contributor

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).

@amigrave
Copy link
Contributor

amigrave commented Sep 2, 2014

Indeed !

I'm used to @mitsuhiko 's style that emphasis reusability but unfortunately it seems he missed that one.

@davidism
Copy link
Member

@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.

@roeeyn
Copy link
Contributor

roeeyn commented Jun 15, 2020

I will be working in this issue 😄

@davidism davidism added this to the 2.0.0 milestone Jul 13, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants