session-desktop/ts/util/saveURLAsFile.ts

18 lines
306 B
TypeScript
Raw Normal View History

2018-04-26 21:26:49 +02: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();
};