Extract `saveURLAsFile`
parent
4c0c55082f
commit
307ab0d3a5
@ -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();
|
||||
};
|
Loading…
Reference in New Issue