download
download(url,[localfile])
Download a file from the given url, optionally renaming it to the given local file name. Note that this function relies on the availability of external tools such as curl, wget or fetch to download the file and is provided for convenience. For production use or situations in which more options are needed, please use a package that provides the desired functionality instead.
Examples
download(url::AbstractString, localfile::AbstractString="")
Download a file from the given url, optionally renaming it to the given localfile. This function relies on external tools such as curl, wget, or fetch to download the file. It is provided for convenience. For production use or situations requiring more options, it is recommended to use a package that provides the desired functionality.
Examples:
-
Download a file from a URL:
julia> download("https://example.com/file.txt")This example downloads the file
file.txtfrom the URLhttps://example.comand saves it in the current working directory. -
Download a file and save it with a different name:
julia> download("https://example.com/image.jpg", "myimage.jpg")In this example, the file
image.jpgfrom the URLhttps://example.comis downloaded and renamed asmyimage.jpgin the current working directory. - Download a file to a specific directory:
julia> download("https://example.com/file.txt", "/path/to/directory/")This example downloads the file
file.txtfrom the URLhttps://example.comand saves it in the specified directory/path/to/directory/.
Common mistake example:
julia> download("https://example.com/file.txt", "/nonexistent/directory/")
ERROR: SystemError: mkdir: no such file or directory (ENOENT)
In this example, the specified destination directory /nonexistent/directory/ does not exist. Make sure to provide a valid path to an existing directory when using the download function.
See Also
abspath, basename, chmod, countlines, cp, ctime, dirname, download, evalfile, expanduser, fdio, filemode, filesize, functionloc, gperm, homedir, include_string, isabspath, isblockdev, ischardev, isdir, isdirpath, isexecutable, isfifo, isfile, islink, ismount, ispath, isreadable, issetgid, issetuid, issticky, iswritable, joinpath, less, lstat, mkdir, mkpath, mktemp, mktempdir, mtime, mv, normpath, operm, poll_fd, poll_file, readall, readcsv, readdir, readdlm, readlines, readlink, realpath, relpath, rm, splitdir, splitdrive, splitext, stat, symlink, tempdir, tempname, touch, truncate, uperm, watch_file, writecsv,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.