This method allows a file to be downloaded from a web service. It creates an XMLHttpRequest object and makes the call using the parameters listed below.
XMLHttpRequest
wire.download({ url: "/download-file", fileName: "sales_oct.xlsx" });
Name
Default
Description
contentType
This value is added to the request header Content-Type if supplied.
Content-Type
data
Sends data in the body of the message. Note, this changes the call from an HTTP GET to a POST.
Callback
fileName
file.txt
The name of the file to be downloaded.
responseType
blob
Sets the responseType on the request.
url
The web service end point from which the file will be downloaded.
The following callbacks can be configured.
done(HttpRequest)
Function that is called when the download has finished successfully.
fail(exception, HttpRequest)
Function that is called if the download fails.
finally(HttpRequest)
Function that is called when the download has finished in success or failure.
Last updated 4 years ago
Was this helpful?