I am interested in loading a file:
url: https://archive.ics.uci.edu/ml/machine-learning-databases/auto-mpg/auto-mpg.data
I am wondering if there is an option equivalent to !wget which can be used in python to load the file.
The equivalent of Python's wget
in Julia is download
To get the file to your disk just run:
download("https://archive.ics.uci.edu/ml/machine-learning-databases/auto-mpg/auto-mpg.data","./autofile.txt")
Do not use run
for this because you take a risk that your code will not be portable.
In order to download files, I tend to use the following helper function, which is fully implemented in Julia, does not rely on the availability of external tools, and is therefore entirely portable across systems (it does, however, depend on HTTP.jl
):
import HTTP
function http_download(url, dest)
HTTP.open(:GET, url) do http
open(dest, "w") do file
write(file, http)
end
end
end
http_download("http://www.julialang.org/", "/tmp/index.html")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With