Newer
Older

Fabien Amarger
committed
export function openFile(file?: Blob) {
if (file) {
const url = URL.createObjectURL(file);
window.open(url);
} else {
console.warn("No file available either locally or on the server");
}
}
export async function downloadFile(url: string) {
const response = await fetch(url, {
credentials: "include",
});
return await response.blob();
}
export function getFileNameFromURL(url: string): string {
return url.slice(url.lastIndexOf("/") + 1);
}