man/omnipath_cache_download_ready.Rd
17c08fe7
 % Generated by roxygen2: do not edit by hand
 % Please edit documentation in R/cache.R
 \name{omnipath_cache_download_ready}
 \alias{omnipath_cache_download_ready}
 \title{Sets the download status to ready for a cache item}
 \usage{
 omnipath_cache_download_ready(version, key = NULL)
 }
 \arguments{
 \item{version}{Version of the cache item. If does not exist a new version
 item will be created}
 
 \item{key}{Key of the cache item}
 }
9ae0bbdd
 \value{
 Character: invisibly returns the version number of the cache
     version item.
 }
17c08fe7
 \description{
 Sets the download status to ready for a cache item
 }
 \examples{
be9cdd4c
 bioc_url <- 'https://bioconductor.org/'
17c08fe7
 # request a new version item (or retrieve the latest)
be9cdd4c
 new_version <- omnipath_cache_latest_or_new(url = bioc_url)
17c08fe7
 # check if the version item is not a finished download
 new_version$status
 # [1] "unknown"
 # download the file
41d6808d
 httr::GET(bioc_url, httr::write_disk(new_version$path, overwrite = TRUE))
17c08fe7
 # report to the cache database that the download is ready
 omnipath_cache_download_ready(new_version)
 # now the status is ready:
be9cdd4c
 version <- omnipath_cache_latest_or_new(url = bioc_url)
17c08fe7
 version$status
 # "ready"
 version$dl_finished
 # [1] "2021-03-09 16:48:38 CET"
be9cdd4c
 omnipath_cache_remove(url = bioc_url) # cleaning up
17c08fe7
 
 }