wire.download

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.

wire.download({
    url: "/download-file",
    fileName: "sales_oct.xlsx"
});

Parameters

Name

Default

Description

contentType

This value is added to the request header Content-Type if supplied.

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.

Events

The following callbacks can be configured.

Name

Description

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