import type { AxiosResponse } from "axios"; export function parseFilenameFromResponse(response: AxiosResponse): string { const contentDisposition = response.headers["content-disposition"]; if (!contentDisposition) return "download"; const filenameMatch = contentDisposition.match(/filename\*=UTF-8''([^;]+)/); if (!filenameMatch?.[1]) return "download"; return decodeURIComponent(filenameMatch[1]); }