List the contents of a version of a project asset. This will call the REST API if the caller is not on the same filesystem as the registry.

listFiles(
  project,
  asset,
  version,
  registry,
  url,
  prefix = NULL,
  include.. = TRUE,
  forceRemote = FALSE
)

Arguments

project

String containing the project name.

asset

String containing the asset name.

version

String containing the version name.

registry

String containing a path to the registry.

url

String containing the URL to the Gobbler REST API. Only used for remote access.

prefix

String containing the prefix for the path. If provided, files are only listed if they have a relative path (i.e., inside the version subdirectory) that starts with this prefix. If NULL, all files associated with this version are listed.

include..

Logical scalar indicating whether to list files with path components that start with ...

forceRemote

Logical scalar indicating whether to force remote access via the API, even if registry is on the same filesystem as the caller.

Value

Character vector of relative paths of files associated with the versioned asset.

Author

Aaron Lun

Examples

info <- startGobbler()
removeProject("test", info$staging, url=info$url) # start with a clean slate.
createProject("test", info$staging, url=info$url)

# Mocking up an upload. 
src <- allocateUploadDirectory(info$staging)
write(file=file.path(src, "foo"), "BAR")
dir.create(file.path(src, "whee"))
write(file=file.path(src, "whee", "blah"), "stuff")
write(file=file.path(src, "whee2"), "more-stuff")
uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)

# List files, with or without a prefix.
listFiles("test", "simple", "v1", registry=info$registry, url=info$url)
#> [1] "..manifest" "..summary"  "foo"        "whee/blah"  "whee2"     
listFiles("test", "simple", "v1", registry=info$registry, prefix="whee")
#> [1] "whee/blah" "whee2"    
listFiles("test", "simple", "v1", registry=info$registry, prefix="whee/")
#> [1] "whee/blah"

# Forcing remote access.
listFiles("test", "simple", "v1", registry=info$registry, url=info$url, forceRemote=TRUE)
#> [1] "..manifest" "..summary"  "foo"        "whee/blah"  "whee2"