function validateImage
validateImage(
data: Uint8Array,
contentType: string,
): ImageValidationResult

Validate an image file: check size, the declared MIME type, and the magic bytes. Both the declared type and the sniffed content must be an accepted upload format; a mismatch or an unsupported format (e.g. a GIF, or a file whose bytes don't match any decodable format) is rejected. On success, detectedType is the sniffed format the transcoder will decode.

Parameters

contentType: string

Return Type

Usage

import { validateImage } from "doc.ts";