Skip to content

Function: downloadByUrl()

ts
function downloadByUrl(Url, type?): void;

Downloads a file from a URL by creating a temporary object URL and clicking a link with a download attribute.

Parameters

ParameterTypeDefault valueDescription
UrlstringundefinedThe URL of the file to download.
typestring'application/octet-stream'The MIME type of the file. Defaults to 'application/octet-stream'.

Returns

void

Example

ts
downloadByUrl('https://example.com/my-file.xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')

Since

1.0.0

Released under the MIT License.