Functions to download (box_dl
), and upload (box_ul
).
box_dl
takes the id
of a file hosted on box.com, downloads it and writes
it to disk.
box_ul
uploads a file stored locally to a specified box.com folder.
If a file with the same name already exists, it will upload the file as
a new version.
box_dl(file_id, local_dir = getwd(), overwrite = FALSE, filename = NULL, version_id = NULL, version_no = NULL, pb = options()$boxr.progress) box_ul(dir_id = box_getwd(), file, pb = options()$boxr.progress, description = NULL)
file_id | The box.com id for the file that you'd like to download |
---|---|
local_dir | A file path to a local directory which you'd like the file to be downloaded to. |
overwrite |
|
filename | Optional. An alternate filename for the local version of the
file. The default, |
version_id | If downloading an older version, the |
version_no | The version of the file you'd like to download (starting at 1) |
pb | Should a progress bar be shown? (via
|
dir_id | If uploading, the box.com folder id that you'd like to upload to. |
file | the path to the local file that you'd like to upload (if there is one) |
description | Optional. |
box_dl
returns the path of the newly downloaded file if successful,
and throw an error otherwise.
box_ul
will return an object of class
boxr_file_reference.
box_dl
can accept one of two parameters to specify file versions:
version_id
and version_no
.
The box.com API refers to file versions using 11 digit ids (which can be
accessed via box_previous_versions()
) - you can specify these
using the version_id
parameter.
However, this isn't terribly intuitive. As a result, box_dl
provides the version_no
parameter, which accepts a whole number,
and corresponds to the versions that you'll see via the web UI. For
example to download the version marked 'V2' on box.com, specify
version_no = 2
. This works by making an internal call to
box_previous_versions()
to retrieve the version_id
,
which makes it slightly slower.
box_fetch()
and box_push()
for
directory-wide equivalents
box_delete_file()
for removing
uploaded files
box_source()
for R code
box_save()
/box_load()
for remote R objects.