best way to generate a text or csv file for user to download

lo there all,

i need to be able to generate a link to a dynamically created text or
csv file when a user hits a link or button ( don't know yet ). But
since the file is going to be generated on the fly, i need an action
to actually create it.

Does anyone have an idea of how the best way to do this would be?


You’ll probably want to take a look at the send_file method:


Also you might find fastercsv useful:

thanks, gents, will check it out.