Angenommen, ich habe eine vorhandene Zip-Datei (out.zip
) in meiner glänzenden App (d. H. Auf einem Server). Ich möchte, dass der Benutzer diese Datei herunterladen kann. Diese Frage ist sehr ähnlich zu this one. Diese Frage reißt jedoch Dateien innerhalb der downloadHandler
, während die Zip-Datei in meinem Fall bereits existiert.R Shiny: Vorhandene Datei herunterladen
library(shiny)
app <- list(
ui = fluidPage(
titlePanel(""),
sidebarLayout(
sidebarPanel(
downloadButton("downloadData", label = "Download")
),
mainPanel(h6("Sample download", align = "center"))
)
),
server = function(input, output) {
output$downloadData <- downloadHandler(
filename <- function() {
paste("output", "zip", sep=".")
},
content <- function(file) {
# not sure what to put here???
},
contentType = "application/zip"
)
}
)
shiny::runApp(app)