INNER CODE UNIT · TypeScript

uploadImage

fill3d/fill · lib/fill3d.ts:56

export async function uploadImage (image: File): Promise<string> {
  const response = await fetch("/api/upload", { method: "POST" });
  const { url, error } = await response.json();
  if (error)
    throw new Error(error);
  await fetch(url, {
    method: "PUT",
    body: await image.arrayBuffer(),
    headers: { "Content-Type": "image/jpeg" }
  });
  const result = new URL(url);
  result.hostname = "cdn.fill3d.ai";
  result.search = "";
  return result.toString();
}

/**
 * Create a scene.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…