it was already revoking
This commit is contained in:
@@ -3,11 +3,12 @@
|
||||
* folder by appending a temporary <a> element to the DOM.
|
||||
*
|
||||
* @param url The URL that we want to download. See also
|
||||
* {@link downloadAndRevokeObjectURL} and {@link downloadString}.
|
||||
* {@link downloadAndRevokeObjectURL} and {@link downloadString}. The URL is
|
||||
* revoked after initiating the download.
|
||||
*
|
||||
* @param fileName The name of downloaded file.
|
||||
*/
|
||||
export const downloadURL = (url: string, fileName: string) => {
|
||||
export const downloadAndRevokeObjectURL = (url: string, fileName: string) => {
|
||||
const a = document.createElement("a");
|
||||
a.style.display = "none";
|
||||
a.href = url;
|
||||
@@ -18,15 +19,6 @@ export const downloadURL = (url: string, fileName: string) => {
|
||||
a.remove();
|
||||
};
|
||||
|
||||
/**
|
||||
* A variant of {@link downloadURL} that also revokes the provided
|
||||
* {@link objectURL} after initiating the download.
|
||||
*/
|
||||
export const downloadAndRevokeObjectURL = (url: string, fileName: string) => {
|
||||
downloadURL(url, fileName);
|
||||
URL.revokeObjectURL(url);
|
||||
};
|
||||
|
||||
/**
|
||||
* Save the given string {@link s} as a file in the user's download folder.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user