mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-25 02:48:23 +01:00
Extract saveURLAsFile
This commit is contained in:
17
ts/util/saveURLAsFile.ts
Normal file
17
ts/util/saveURLAsFile.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
export const saveURLAsFile = ({
|
||||
filename,
|
||||
url,
|
||||
document,
|
||||
}: {
|
||||
filename: string;
|
||||
url: string;
|
||||
document: Document;
|
||||
}): void => {
|
||||
const anchorElement = document.createElement('a');
|
||||
anchorElement.href = url;
|
||||
anchorElement.download = filename;
|
||||
anchorElement.click();
|
||||
};
|
||||
Reference in New Issue
Block a user