as_attachment | R Documentation |
This will set the appropriate fields in the Content-Disposition
header value.
To make sure the attachment is used, be sure your serializer eventually calls serializer_headers
as_attachment(value, filename = NULL)
value |
Response value to be saved |
filename |
File name to use when saving the attachment.
If no |
Object with class "plumber_attachment"
## Not run:
# plumber.R
#' @get /data
#' @serializer csv
function() {
# will cause the file to be saved as `iris.csv`, not `data` or `data.csv`
as_attachment(iris, "iris.csv")
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.