Provides a simple caching mechanism for TRUD files.
This is deliberately not a generic download manager. It provides only a lightweight and synchronous cache for downloads.
Provides a simple caching mechanism for TRUD files. This is deliberately not a generic download manager. It provides only a lightweight and synchronous cache for downloads.
(download-url url target)
Download a file from the URL to the target path. Parameters:
Download a file from the URL to the target path. Parameters: - url : a string representation of a URL. - target : target (outputstream, writer or file).
(get-archive-file dir release)
Get an archive file either from the cache or downloaded from TRUD.
Returns result as a java.nio.file.Path
.
Get an archive file either from the cache or downloaded from TRUD. Returns result as a `java.nio.file.Path`.
(get-release-file dir release)
(get-release-file
dir
{url :archiveFileUrl file-size :archiveFileSizeBytes :as release}
{:keys [progress]})
Get an archive file either from the cache or downloaded from TRUD.
Get an archive file either from the cache or downloaded from TRUD.
(make-cache dir)
(make-cache dir {:keys [progress download-fn] :or {download-fn download-url}})
Create a simple cache in the directory specified.
Returns a function that can be used to download from a URL to a filename, that
will use the directory as a cache. An optional validate
function can be
provided to check file size or checksum, for example. If progress
is
truthy, then progress will be printed.
The resulting function will take a job (a map of :url :filename :file-size and
:validate) and return a map of :cached and :f.
Create a simple cache in the directory specified. Returns a function that can be used to download from a URL to a filename, that will use the directory as a cache. An optional `validate` function can be provided to check file size or checksum, for example. If `progress` is truthy, then progress will be printed. The resulting function will take a job (a map of :url :filename :file-size and :validate) and return a map of :cached and :f.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close