Skip to contents

The file viewer module provides a tool to view static files. Supported formats include text formats, PDF, PNG, APNG, JPEG, SVG, WEBP, GIF and BMP.

Usage

tm_file_viewer(
  label = "File Viewer Module",
  input_path = list(`Current Working Directory` = ".")
)

Arguments

label

(character) Label shown in the navigation item for the module.

input_path

optional, (list) of the input paths to either: specific files of accepted formats, a directory or a URL. The paths can be specified as absolute paths or relative to the running directory of the application. Will default to current working directory if not supplied.

Examples

data <- data.frame(1)
app <- init(
  data = teal_data(
    dataset("data", data)
  ),
  modules = modules(
    tm_file_viewer(
      input_path = list(
        folder = system.file("sample_files", package = "teal.modules.general"),
        png = system.file("sample_files/sample_file.png", package = "teal.modules.general"),
        txt = system.file("sample_files/sample_file.txt", package = "teal.modules.general"),
        url = "https://www.fda.gov/files/drugs/published/Portable-Document-Format-Specifications.pdf"
      )
    )
  )
)
#> [INFO] 2022-06-14 17:42:25.1025 pid:1110 token:[] teal.modules.general Initializing tm_file_viewer
if (FALSE) {
shinyApp(app$ui, app$server)
}