【发布时间】:2016-01-29 17:34:09
【问题描述】:
假设我在闪亮的应用程序(即位于服务器上)中有一个现有的 zip 文件 (out.zip)。我希望用户能够下载此文件。这个问题与this one 非常相似。但是,该问题会压缩 downloadHandler 中的文件,而在我的情况下 zip 文件已经存在。
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)
【问题讨论】: