retrieveMetadata.Rd
Retrieve a single metadata entry in a registered directory from the SewerRat API.
retrieveMetadata(path, url)
A named list containing path
, the path to the metadata file;
user
, the identity of the owning user;
time
, the Unix time at which the file was modified;
and metadata
, the loaded metadata, typically as a named list representing a JSON object.
info <- startSewerRat()
# Mocking up a directory of stuff to query.
mydir <- tempfile()
dir.create(mydir)
write(file=file.path(mydir, "metadata.json"), '{ "first": "Aaron", "last": "Lun" }')
dir.create(file.path(mydir, "diet"))
write(file=file.path(mydir, "diet", "metadata.json"),
'{ "meal": "lunch", "ingredients": "water" }')
# Registering it:
register(mydir, "metadata.json", url=info$url)
retrieveMetadata(paste0(mydir, "/metadata.json"), url=info$url)
#> $path
#> [1] "/tmp/Rtmpf63hzc/file1cd144d66d7/metadata.json"
#>
#> $user
#> [1] "root"
#>
#> $time
#> [1] 1732572191
#>
#> $metadata
#> $metadata$first
#> [1] "Aaron"
#>
#> $metadata$last
#> [1] "Lun"
#>
#>
retrieveMetadata(paste0(mydir, "/diet/metadata.json"), url=info$url)
#> $path
#> [1] "/tmp/Rtmpf63hzc/file1cd144d66d7/diet/metadata.json"
#>
#> $user
#> [1] "root"
#>
#> $time
#> [1] 1732572191
#>
#> $metadata
#> $metadata$meal
#> [1] "lunch"
#>
#> $metadata$ingredients
#> [1] "water"
#>
#>