mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-23 08:16:16 -04:00
13 lines
314 B
TypeScript
13 lines
314 B
TypeScript
![]() |
import type { Ref } from 'vue';
|
||
|
|
||
|
export function useDownloadFileFromBase64({ source, filename = 'file' }: { source: Ref<string>; filename?: string }) {
|
||
|
return {
|
||
|
download() {
|
||
|
const a = document.createElement('a');
|
||
|
a.href = source.value;
|
||
|
a.download = filename;
|
||
|
a.click();
|
||
|
},
|
||
|
};
|
||
|
}
|