export type GetApiFilesystemsFilesystemIdFileDownloadArgs = {filesystem_id: string, path: string}; export type GetApiFilesystemsFilesystemIdFileDownloadOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Download File * * GET /filesystems/{filesystem_id}/file-download */ export const getApiFilesystemsFilesystemIdFileDownload = async (args: GetApiFilesystemsFilesystemIdFileDownloadArgs, options: GetApiFilesystemsFilesystemIdFileDownloadOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (args.path != null) query.append("path", String(args.path)) const url = `${baseUrl.replace(/\/+$/, '')}/filesystems/${encodeURIComponent(String(args.filesystem_id))}/file-download${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };