export type DeleteApiV2NameBlobsDigestArgs = {name: string, digest: string}; export type DeleteApiV2NameBlobsDigestOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Delete image blob/layer * * DELETE /v2/{name}/blobs/{digest} */ export const deleteApiV2NameBlobsDigest = async (args: DeleteApiV2NameBlobsDigestArgs, options: DeleteApiV2NameBlobsDigestOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/v2/${encodeURIComponent(String(args.name))}/blobs/${encodeURIComponent(String(args.digest))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };