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: 2023-07-31 15:55
#>   Status: 200
#>   Content-Type: text/html
#>   Size: 20.7 kB
#> <ON DISK>  /tmp/RtmpztLmFt/file895a13568b3a5.html
omnipath_cache_move_in(path = html_file, url = bioc_url)
omnipath_cache_remove(url = bioc_url) # cleaning up