Closed m-murphy closed 2 months ago
Hi,
I'm working on building a dashboard that would have some data download functionality, but it doesn't seem to work. The download file prompt opens, but the file sent is empty and named incorrectly. Here's a reproducible example
library(shiny) library(bslib) ui <- page_fluid( downloadButton("downloadData", "Download") ) server <- function(input, output, session) { output$downloadData <- downloadHandler( filename = function() { paste("data-", Sys.Date(), ".csv", sep="") }, content = function(file) { write.csv(mtcars, file) } ) } shinyApp(ui = ui, server = server)
which is then exported using shinylive::export(".", "_static") and then hosted with httpuv::runStaticServer("_site")
shinylive::export(".", "_static")
httpuv::runStaticServer("_site")
Downloads work fine as a regular shiny app.
Here's my session info also if that helps
─ Session info ───────────────────────────────────────────────────────────────────────────────── setting value version R version 4.4.0 (2024-04-24) os Pop!_OS 22.04 LTS system x86_64, linux-gnu ui X11 language (EN) collate en_US.UTF-8 ctype en_US.UTF-8 tz America/Los_Angeles date 2024-05-09 pandoc 2.9.2.1 @ /usr/bin/pandoc ─ Packages ───────────────────────────────────────────────────────────────────────────────── package * version date (UTC) lib source brio 1.1.5 2024-04-24 [1] RSPM bslib * 0.7.0 2024-03-29 [1] RSPM cachem 1.0.8 2023-05-01 [1] RSPM cli 3.6.2 2023-12-11 [1] RSPM crayon 1.5.2 2022-09-29 [1] RSPM curl 5.2.1 2024-03-01 [1] RSPM devtools * 2.4.5 2022-10-11 [1] RSPM digest 0.6.35 2024-03-11 [1] RSPM ellipsis 0.3.2 2021-04-29 [1] RSPM fansi 1.0.6 2023-12-08 [1] RSPM fastmap 1.1.1 2023-02-24 [1] RSPM filelock 1.0.3 2023-12-11 [1] RSPM fontawesome 0.5.2 2023-08-19 [1] RSPM fs 1.6.4 2024-04-25 [1] RSPM glue 1.7.0 2024-01-09 [1] RSPM hms 1.1.3 2023-03-21 [1] RSPM htmltools 0.5.8.1 2024-04-04 [1] RSPM htmlwidgets 1.6.4 2023-12-06 [1] RSPM httpuv 1.6.15 2024-03-26 [1] RSPM jquerylib 0.1.4 2021-04-26 [1] RSPM jsonlite 1.8.8 2023-12-04 [1] RSPM later 1.3.2 2023-12-06 [1] RSPM lifecycle 1.0.4 2023-11-07 [1] RSPM magrittr 2.0.3 2022-03-30 [1] RSPM memoise 2.0.1 2021-11-26 [1] RSPM mime 0.12 2021-09-28 [1] RSPM miniUI 0.1.1.1 2018-05-18 [1] RSPM pillar 1.9.0 2023-03-22 [1] RSPM pkgbuild 1.4.4 2024-03-17 [1] RSPM pkgcache 2.2.2 2024-04-04 [1] RSPM pkgconfig 2.0.3 2019-09-22 [1] RSPM pkgdepends 0.7.2 2024-03-17 [1] RSPM pkgload 1.3.4 2024-01-16 [1] RSPM prettyunits 1.2.0 2023-09-24 [1] RSPM profvis 0.3.8 2023-05-02 [1] RSPM progress 1.2.3 2023-12-06 [1] RSPM promises 1.3.0 2024-04-05 [1] RSPM purrr 1.0.2 2023-08-10 [1] RSPM R6 2.5.1 2021-08-19 [1] RSPM rappdirs 0.3.3 2021-01-31 [1] RSPM Rcpp 1.0.12 2024-01-09 [1] RSPM remotes 2.5.0 2024-03-17 [1] RSPM renv 1.0.7 2024-04-11 [1] RSPM rlang 1.1.3 2024-01-10 [1] RSPM rstudioapi 0.16.0 2024-03-24 [1] RSPM sass 0.4.9 2024-03-15 [1] RSPM sessioninfo 1.2.2 2021-12-06 [1] RSPM shiny * 1.8.1.1 2024-04-02 [1] RSPM shinylive 0.1.1.9000 2024-05-09 [1] Github (posit-dev/r-shinylive@097a7b8) stringi 1.8.4 2024-05-06 [1] RSPM stringr 1.5.1 2023-11-14 [1] RSPM tibble 3.2.1 2023-03-20 [1] RSPM urlchecker 1.0.1 2021-11-30 [1] RSPM usethis * 2.2.3 2024-02-19 [1] RSPM utf8 1.2.4 2023-10-22 [1] RSPM vctrs 0.6.5 2023-12-01 [1] RSPM xtable 1.8-4 2019-04-21 [1] RSPM [1] /home/mmurphy/R/x86_64-pc-linux-gnu-library/4.4 [2] /opt/R/4.4.0/lib/R/library ───────────────────────────────────────────────────────────────────────────────────
Never mind, I see this is addressed in #74
Hi,
I'm working on building a dashboard that would have some data download functionality, but it doesn't seem to work. The download file prompt opens, but the file sent is empty and named incorrectly. Here's a reproducible example
which is then exported using
shinylive::export(".", "_static")
and then hosted withhttpuv::runStaticServer("_site")
Downloads work fine as a regular shiny app.
Here's my session info also if that helps