downloadFile: downloadFile Module

Description Usage Arguments Shiny Usage See Also Examples

View source: R/downloadFile.R

Description

Server-side function for the downloadFileButton. This is a custom high-functionality button for file downloads supporting single or multiple download types. The server function is used to provide the data for download.

Usage

1
2
3
4
5
6
7
8
9
downloadFile(
  input,
  output,
  session,
  logger,
  filenameroot,
  datafxns = list(),
  aspectratio = 1
)

Arguments

input

provided by shiny::callModule

output

provided by shiny::callModule

session

provided by shiny::callModule

logger

logger to use

filenameroot

the base text used for user-downloaded file - can be either a character string or a reactive expression that returns a character string

datafxns

a named list of functions providing the data as return values. The names for the list should be the same names that were used when the button UI was created.

aspectratio

the downloaded chart image width:height ratio (ex: 1 = square, 1.3 = 4:3, 0.5 = 1:2). Where not applicable for a download type it is ignored (e.g. data downloads).

Shiny Usage

This function is not called directly by consumers - it is accessed in server.R using the same id provided in downloadFileButton:

callModule(downloadFile, id, logger, filenameroot, datafxns)

See Also

downloadFileButton

downloadFile_ValidateTypes

downloadFile_AvailableTypes

callModule

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Inside server_local.R

#single download type
# callModule(downloadFile, 
#            "object_id1", 
#            logger = ss_userAction.Log,
#            filenameroot = "mydownload1",
#            datafxns = list(csv = mydatafxn1),
#            aspectratio = 1)

#multiple download types
# callModule(downloadFile, 
#            "object_id2",
#            logger = ss_userAction.Log,
#            filenameroot = "mytype2",
#            datafxns = list(csv = mydatafxn1, xlsx = mydatafxn2),
#            aspectratio = 1)

periscope documentation built on July 8, 2020, 7:18 p.m.