function validateImageUpload
validateImageUpload(data: Uint8Array): string

Checks an uploaded image's size and content, and returns its MIME type, which the route stores to serve the image with.

Parameters

Return Type

string

Throws

APIException

400 when it exceeds MAX_IMAGE_SIZE_BYTES or isn't a JPEG, PNG, GIF or WebP image.

Usage

import { validateImageUpload } from "api/lib/upload.ts";