In the docs for Downloads.download, there are no examples and the errors don’t help.
For instance, I’m trying to download a Projects.toml
file from another repository.
julia> project_url = "https://raw.githubusercontent.com/JuliaDynamics/DrWatson.jl/master/Project.toml"
julia> project_file = Downloads.download(project_url)
This goes to an auto-created temporary path, as the docs say. But I can’t understand the following to put it in a custom path:
download(url, [ output = tempfile() ];
[ method = "GET", ]
[ headers = <none>, ]
[ timeout = <none>, ]
[ progress = <none>, ]
[ verbose = false, ]
[ downloader = <default>, ]
) -> output
url :: AbstractString
output :: Union{AbstractString, AbstractCmd, IO}
method :: AbstractString
headers :: Union{AbstractVector, AbstractDict}
timeout :: Real
progress :: (total::Integer, now::Integer) --> Any
verbose :: Bool
downloader :: Downloader
For instance, typing the following gives an error:
julia> project_file = Downloads.download(project_url, [output=tempfile()])
ERROR: syntax: misplaced assignment statement in "[output = tempfile()]" around REPL[16]:1
Stacktrace:
[1] top-level scope
@ REPL[16]:1
The docs say " Download a file from the given url, saving it to output
or if not specified, a temporary path."
How do I change where output
is?