Unlike other boards, board_url can point directly to to-be-downloaded files. In order to work with cache functions like cache_prune() and pins:::cache_versions(), this board runs this process when downloading a single file:
if url does not end with /, it is a single file
download the file, and put a download-cache.yaml in the cached pin version
run cache_touch, which creates an empty data.txt in cached pin version
Because functions like cache_versions look for the structure <cache_root>/<board_hash>/<pin>/<version>/data.txt, this should work okay. The only issue afaict is that the cache is using <pin>/data.txt, rather than <pin>/<version>/data.txt.
Example
github_raw <- "https://raw.githubusercontent.com/"
board <- board_url(c(
files = paste0(github_raw, "rstudio/pins/master/tests/testthat/pin-files/"),
rds = paste0(github_raw, "rstudio/pins/master/tests/testthat/pin-rds/"),
raw = paste0(github_raw, "rstudio/pins/master/tests/testthat/pin-files/first.txt")
))
board %>% pin_download("files")
board %>% pin_download("raw")
# output: [1] "~/Library/Caches/pins/url/87473d3442e598f929b65b6630da6fd8/first.txt"
# note that the cached pin also has data.txt, and download-cache.yaml created in it
# looks for <pin>/<version>/data.txt file, so doesn't find anything
pins:::cache_versions()
cache_prune(0) # no stale pins found
This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.
Unlike other boards, board_url can point directly to to-be-downloaded files. In order to work with cache functions like
cache_prune()
andpins:::cache_versions()
, this board runs this process when downloading a single file:/
, it is a single fileBecause functions like
cache_versions
look for the structure<cache_root>/<board_hash>/<pin>/<version>/data.txt
, this should work okay. The only issue afaict is that the cache is using<pin>/data.txt
, rather than<pin>/<version>/data.txt
.Example