File$download(path=getwd(), *, overwrite=FALSE) str

Downloads the file to the specified path, or the current working directory if no path is specified.

If you are downloading multiple files from a table or query result, you'll see significantly better performance (due to parallelization) by calling Table$download_files or Query$download_files.


path : str, default getwd() The path for where to download the file. If the path represents a directory that already exists, or ends in a path separator (e.g., /), the path is assumed to be a directory, and the file will be downloaded into that directory (using the name of the file on Redivis). If the path doesn't end in a directory, the path is assumed to include the name of the downloaded file. If the path specifies any (sub)directories that do not exist, they'll automatically be created. If no path is specified, the file is downloaded to the current working directory.

overwrite : bool, default FALSE Whether to overwrite any existing file if the same file already exists at the download path.


str (the path of the downloaded file)


f = redivis::file("4c10-d8rqhswh8.zz7AB9NJB2ctNpDGKbRD7w")

f$download() # download to current working directory
f$download("new_name.tiff") # download to current working directory, and rename to new_name.tiff
f$download("/some/path/") # downloaded as /some/path/bogota.tiff
f$download("/some/path/new_name.tiff") # downloaded as /some/path/new_name.tiff

# { 
#   "kind": "rawFile", 
#   "id": "4c10-d8rqhswh8.zz7AB9NJB2ctNpDGKbRD7w", 
#   "uri': '/rawFiles/4c10-d8rqhswh8.zz7AB9NJB2ctNpDGKbRD7w",
#   "name": "bogota.tiff", 
#   "md5Hash": "6pQS54rKwQphRtJbLlHz7Q==", 
#   "contentType": "image/tiff", 
#   "size": 262674
# }

Last updated