download data specified by a URL to a file
Download( url, destination, options )
string specifying the URL from which to request data
(optional) file or directory to which the data should be written
one or more options as specified below
A certificate file to use when authenticating the server. Maple includes a certificate file containing certificates for the major Certificate Authorities.
mode=one of text or binary
Specifies whether the reply data should be treated as a string (mode=text) or as an Array with data type integer (mode=binary). This is only supported by the http and https schemes. FTP transfers are always treated as binary.
output=list or one of filename, headers, or size
A list of one or more of the symbols filename, headers, and size, or one of the symbols filename, headers, or size. The output will be an expression sequence with values corresponding to the specified keywords. The meaning of the symbols is as follows:
filename is the file name to which the downloaded data was written.
headers refers to the http (and https) header received from the server. It is not supported for URLs with the ftp scheme. It is returned as a table of strings.
size refers to the size (in bytes) of the downloaded data. It is returned as an integer.
This option is only valid with http and https schemes. The default is filename.
The password for authentication. This supersedes any password included in url directly.
A URL for a proxy server. This should include the protocol, host, and port number (if not default), For example, to connect to an HTTP proxy myproxy on port 3421, use proxy="http://myproxy:3421".
Password to use for authentication against the proxy specified by the proxy option.
username to use for authentication against the proxy specified by the proxy option.
For HTTP transfers, the number of times Maple should follow a redirect response (HTTP status 3xx) before giving up. The default is 20, meaning 20 redirections are followed before giving up.
requestheaders=list(string) or table
A list of strings and equations of strings that will be added to the http header that is sent as part of the request.
A list of strings specifying header fields to be returned. This only has an effect if headers is specified in the output option. If this option is not given, all received headers will be returned.
The number of seconds to wait before aborting the transfer. The default is infinity (in other words, no timeout).
The user name for authentication. This supersedes any user name included in url directly.
Specifies whether Maple should authenticate the identity of the server by verifying its SSL certificate against a list of verified Certificate Authorities. The default is true. This option is only valid when using https.
Download(url,destination) fetches data from the address specified in url and saves it to a file or directory destination.
If destination is specified and a file with this name does not exist in the current directory, the data is saved to this filename.
If destination is specified and corresponds to an existing file, the data is saved to a temporary filename in the same directory.
If destination is specified and corresponds to an existing directory, the data is saved to a temporary filename in that directory.
If destination is not specified, the data is saved to a temporary filename in the current directory.
The Download command uses a GET request to fetch the remote URL. To use other HTTP schemes or provide additional configuration details such as login credentials or proxy settings, see the URL package.
The current implementation of Download is not secure. Between generating the unique filename and creating the file, another process may be able to create a file with the same name. By doing so, the other process can read information from or write information into the file.
The URL[Download] command was introduced in Maple 2019.
For more information on Maple 2019 changes, see Updates in Maple 2019.
The URL[Download] command was updated in Maple 2020.
The cafile, password, proxy, proxypassword, proxyuser, redirections, requestheaders, responseheaders, timeout, user and verify options were introduced in Maple 2020.
For more information on Maple 2020 changes, see Updates in Maple 2020.
Download Help Document