session-desktop/ts/util/saveURLAsFile.ts
2018-04-27 16:31:43 -04:00

17 lines
306 B
TypeScript

/**
* @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();
};