I have build a shiny app for non-technical user in my organisation to run script for standard task. The run time of script is around 30 mins or so. As I don't expect user to check the progress regularly, I am hoping to trigger download automatically after finishing running script, using the on.exit() function.
#pseudo example
library(shiny)
ui <- fluidPage(
runButton = actionButton(
inputId = "RunFunction1",
label = strong("Run Function!"),
color = "primary"))
server <- function(input,output) {
observeEvent(input$RunFunction1,{
#This is the main script i am running, which takes 30 mins. The function will save a large xlsx
#file in the working directory
standard_script
# I am hoping to trigger the download on exit. However I am not sure how to point to the working
# directory
on.exit(download.file())
}
}
shinyApp(ui = ui, server = server)
I am aware that there is shinyjs solution out there. However, I would like to explore the on.exit download file option.