I'm using plumber as a simple web-api service for some R functions.
I would like to provide a file 'download' (on the client side) through an R function very much like flask is doing it in python through send_file and send_from_directory.
I tried
#* @get /datafile
get_file <- function(){
return(file('path-to-file.RData'))
}
But unfortunately it didn't work (because the return value cannot be transformed to JSON). I'm aware of static file server option in plubmer, but I really want to provide only one single file and not a directory. (Although serving files in directory through @assets
seems to be a more secure option.)