Clone the contents of a project version onto the local filesystem.

cloneProjectVersion(
  dir,
  url,
  project,
  version,
  link.only = FALSE,
  cache = NULL
)

Arguments

dir

String containing a path to the destination directory.

url

String containing the URL to the REST API.

project

String containing the project name.

version

String containing the project version.

link.only

Logical scalar indicating whether to create placeholder links instead of copies of the non-metadata files.

cache

Caching function to use in getFile or getFileMetadata.

Value

A directory is created at dir with the contents of the specified project version. NULL is invisibly returned.

Details

If link.only=TRUE is specified, all non-metadata files are replaced by placeholder links using createPlaceholderLink. This avoids the download while retaining the project structure for further modifications, e.g., using initializeUpload.

If cache is provided, metadata documents are first cached and then copied to dir. This avoids re-downloads of the same documents in subsequent cloneProjectVersion calls. If link.only=FALSE, non-metadata files will also be cached.

See also

createPlaceholderLink, for the link creation procedure.

Author

Aaron Lun

Examples

tmp <- tempfile()
cloneProjectVersion(tmp, example.url, example.project, example.version)
list.files(tmp, recursive=TRUE)
#> [1] "blah.txt"         "blah.txt.json"    "foo/bar.txt"      "foo/bar.txt.json"
#> [5] "whee.txt"         "whee.txt.json"