oatpp / oatpp

🌱Light and powerful C++ web framework for highly scalable and resource-efficient web application. It's zero-dependency and easy-portable.
https://oatpp.io/
Apache License 2.0
7.73k stars 1.3k forks source link

Download a file from backend via GET method #859

Open ml16685 opened 11 months ago

ml16685 commented 11 months ago

Hello,

There is the tutorial which describes how to upload a file to backend via POST method: https://oatpp.io/docs/features/upload-file/

Is there Oatpp API to do the reverse operation, i.e. to download the file from backend via GET method? Maybe there is API description or an example?

Thanks in advance.

doufu3344 commented 11 months ago

see https://github.com/oatpp/oatpp/issues/715#issuecomment-1480438930

mrbesen commented 9 months ago

see #715 (comment)

I think that @ml16685 meant something different: Imagine a process generates a dynamic file. Now you want to provide a GET request for the user to access this file. How would you do that? The only option i see is to load the file into an oatpp::String and use createResponse or to implement a custom class implementing the Body abstract class. I think an option to take an fd or file path and instruct oatpp to stream the content would be nice.