reconstituteFileFromExport function

Save a File to a Local Directory from a Response

Save a File to a Local Directory from a Response

Converts the file from a response object and saves it to the local file directory.

reconstituteFileFromExport( response, dir, dir_create = FALSE, file_prefix = "", filename = character(0) )

Arguments

  • response: An object of class response.
  • dir: character(1) A directory on the local file system into which the file will be saved.
  • dir_create: logical(1) If TRUE and the directory does not exist, it will be created. Defaults to FALSE. If dir does not exist and create = FALSE, an error is thrown.
  • file_prefix: character(1) An optional prefix to prepend to the file name. This may be desirable to explicitly associate files with a record and/or event.
  • filename: character(0/1) An optional filename. This is used in the case where a filename is being provided. It this has length 0, the filename will be extracted from the API response.

Examples

## Not run: unlockREDCap(connections = c(rcon = "project_alias"), url = "your_redcap_url", keyring = "API_KEYs", envir = globalenv()) response <- makeApiCall(rcon, body = list(content = 'file', action = 'export', record = '1', field = 'file_upload_test', event = 'event_1_arm_1')) reconstituteFileFromExport(response, dir = tempdir()) ## End(Not run)

See Also

exportFiles(),

exportFromFileRepository(),

exportFileRepository(),

exportPdf()

  • Maintainer: Shawn Garbett
  • License: GPL-2
  • Last published: 2024-10-17