I’m trying to wrap my head around how Phoenix returns file contents. I see there’s a way to stream a file download (so long as the file is accessible on the server somewhere), but I’m not quite seeing how to serve a dynamic file that’s created on the fly. For educational purposes, I want to do this without streams or chunks.
In pseudo-code, I want something like the following in a controller:
send_content_type_header('content-type: image/jpg')
generate_image_data()
I can see how to set the proper response headers on the Plug.Con, but I don’t see how to send arbitrary data as the body of the response.