signal-desktop/ts/util/saveURLAsFile.ts

18 lines
306 B
TypeScript
Raw Normal View History

2018-04-26 19:26:49 +00:00
/**
* @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();
};