Function to downlod files attached to an item on SB. Either files can be
specified directly using the names and destinations parameters,
or a dest_dir can be supplied where all attached files will be written
with the names as stored on SB.
Usage
item_file_download(
sb_id,
...,
names,
destinations,
dest_dir = getwd(),
overwrite_file = FALSE
)Arguments
- sb_id
An
sbitemobject or a character ScienceBase ID corresponding to the item- ...
Additional parameters are passed on to
GET,POST,HEAD,PUT.- names
String vector list of file names attached to item that you wish to download.
- destinations
String vector list of destinations for requested files. Must be same length as
names- dest_dir
A directory path for saving files when
namesdestinations parameter is not specified.- overwrite_file
Boolean indicating if file should be overwritten if it already exists locally
Examples
if (FALSE) { # \dontrun{
#downloads all files attached to this item
item_file_download('627f1572d34e3bef0c9a30d8', dest_dir=tempdir())
#downloads a specific file attached to this item
item_file_download('627f1572d34e3bef0c9a30d8', names='example.txt',
destinations=file.path(tempdir(), 'out.txt'))
} # }