Boot task to download a file from the given url.
(download-file [u url VAL str "The location of the remote file."
o output-file VAL str "The location used to save the file. Optional."])Downloads a single file from the given url and adds it to the fileset as an asset.
If the output file path is not set then the task will get the file name from the url and store the file under that name in the fileset root directory.
Caution!
The task will fail if the
output-filewas not specified AND the url has parameters (i.e.http://example.org/file?p=foo&q=bar).
(get-all-downloaded-files [fileset])Gets a seq of files (as TmpFile objects) downloaded by the
download-file task.
(get-all-files-downloaded-from [fileset url])Gets a seq of files (as TmpFile objects) downloaded from the
given url by the download-file task.
It could happen that the fileset has a few files downloaded
from the same url. That's why this function returns a seq instead of a
single object (or nil). The sequence will be empty, if there
is no files downloaded from the given url.
You can use this function to get TmpFile of the downloaded
file, when you don't know its path, i.e. you didn't provide
output-file option.
(get-download-url [tmpfile])Gets a url the given TmpFile was downloaded from.
(deftask download-electron
[]
(let [root "https://github.com/electron/electron/releases/download"]
(comp
(download-file :url (str root "/v1.7.4/electron-v1.7.4-linux-x64.zip")
:output-file "downloads/electron-v1.7.4-linux-x64.zip")
(extract-from-zip :archive "downloads/electron-v1.7.4-linux-x64.zip"
:output-dir "extracted/electron/v1.7.4/linux-x64")
(target))))Download a file and save it in target directory:
boot download-file --url https://raw.githubusercontent.com/manenko/boot-download/master/README.rst --output-file downloads/doc/boot-download.rst target
Copyright © 2017 Oleksandr Manenko.
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.