Learn R Programming

periscope (version 1.0.4)

downloadFile: downloadFile Module

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

downloadFile(..., logger, filenameroot, datafxns = list(), aspectratio = 1)

Arguments

...

free parameters list for shiny to pass session variables based on the module call(session, input, output) variables. Note: The first argument of this function must be the ID of the Module's UI element

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:

downloadFile(id, logger, filenameroot, datafxns)

See Also

downloadFileButton

downloadFile_ValidateTypes

downloadFile_AvailableTypes

Examples

Run this code
# Inside server_local.R

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

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

Run the code above in your browser using DataLab