import { putLocalBlob } from "./local-blob"; /** * Picks the storage driver by env: Vercel Blob when a store is connected * (`BLOB_STORE_ID` from OIDC-mode `vercel storage connect`, or a static * `BLOB_READ_WRITE_TOKEN`), local disk otherwise (Coolify self-host, see * local-blob.ts). */ export async function putBlob( key: string, file: File, opts: { contentType: string }, baseUrl: string ): Promise<{ url: string }> { if (process.env.BLOB_STORE_ID || process.env.BLOB_READ_WRITE_TOKEN) { const { put } = await import("@vercel/blob"); const blob = await put(key, file, { access: "public", contentType: opts.contentType, addRandomSuffix: true, }); return { url: blob.url }; } return putLocalBlob(key, file, opts, baseUrl); }