Files
Entkube/src/EntKube.Web/Components/Pages/Tenants/StorageBrowser.razor.js
2026-06-04 08:51:22 +02:00

21 lines
593 B
JavaScript

export async function copyToClipboard(text) {
try {
await navigator.clipboard.writeText(text);
return true;
} catch {
return false;
}
}
export function downloadFile(fileName, contentType, byteArray) {
const blob = new Blob([new Uint8Array(byteArray)], { type: contentType });
const url = URL.createObjectURL(blob);
const anchor = document.createElement('a');
anchor.href = url;
anchor.download = fileName;
document.body.appendChild(anchor);
anchor.click();
document.body.removeChild(anchor);
URL.revokeObjectURL(url);
}