export type UUIDSchema = string; export type GetApiInspectImageUuidArchiveArgs = {image_uuid: UUIDSchema, path: string}; export type GetApiInspectImageUuidArchiveOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download a file or a directory from image as tar archive * * GET /inspect/{image_uuid}/archive */ export const getApiInspectImageUuidArchive = async (args: GetApiInspectImageUuidArchiveArgs, options?: GetApiInspectImageUuidArchiveOptions) => { const {baseUrl = "https://api.tokenfactory.nebius.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/x-tar") if (args.path != null) query.append("path", String(args.path)) const url = `${baseUrl.replace(/\/+$/, '')}/inspect/${encodeURIComponent(String(args.image_uuid))}/archive${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() };