export type GetApiApiUserdataFileArgs = {file: string}; export type GetApiApiUserdataFileOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get user data file * * GET /api/userdata/{file} */ export const getApiApiUserdataFile = async (args: GetApiApiUserdataFileArgs, options?: GetApiApiUserdataFileOptions) => { const {baseUrl = "https://api.comfy.org", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") const url = `${baseUrl.replace(/\/+$/, '')}/api/userdata/${encodeURIComponent(String(args.file))}${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() };