@humanwhocodes/crosspost
Version:
A utility to post across multiple social networks.
12 lines (11 loc) • 460 B
TypeScript
/**
* @fileoverview Utility functions for working with images.
* @author Nicholas C. Zakas
*/
/**
* Determines the MIME type of an image from its binary data.
* @param {Uint8Array} bytes The image data to examine.
* @returns {"image/png"|"image/jpeg"|"image/gif"} The MIME type of the image.
* @throws {TypeError} If the image type cannot be determined.
*/
export function getImageMimeType(bytes: Uint8Array): "image/png" | "image/jpeg" | "image/gif";