Skip to contents

Either the key or the URL (with POST and payload) must be provided.

Usage

omnipath_cache_move_in(
  path,
  key = NULL,
  version = NULL,
  url = NULL,
  post = NULL,
  payload = NULL,
  keep_original = FALSE
)

Arguments

path

Path to the source file

key

Key of the cache item

version

Version of the cache item. If does not exist a new version item will be created

url

URL of the downloaded resource

post

HTTP POST parameters as a list

payload

HTTP data payload

keep_original

Whether to keep or remove the original file

Value

Character: invisibly returns the version number of the cache version item.

Examples

path <- tempfile()
saveRDS(rnorm(100), file = path)
omnipath_cache_move_in(path, url = 'the_download_address')

# basic example of moving a file to the cache:

bioc_url <- 'https://bioconductor.org/'
html_file <- tempfile(fileext = '.html')
httr::GET(bioc_url, httr::write_disk(html_file, overwrite = TRUE))
#> Response [https://bioconductor.org/]
#>   Date: 2024-04-07 15:20
#>   Status: 200
#>   Content-Type: text/html
#>   Size: 37.3 kB
#> <ON DISK>  /tmp/RtmpgsvP1J/file165a6042ded112.html
omnipath_cache_move_in(path = html_file, url = bioc_url)
omnipath_cache_remove(url = bioc_url) # cleaning up