formats.exposed/public/index/constants.js

24 lines
905 B
JavaScript
Raw Normal View History

// @ts-check
/**
* @typedef {object} SupportedFileType
* @prop {string} name The English name of a file type.
* @prop {string[]} extensions File extension for this type, with the leading dot.
* @prop {string} mimeType MIME type for this file type.
* @prop {string} route The route to the file type's page.
* @prop {ArrayLike<number>} mimeSniffBytePattern The byte pattern to use for MIME sniffing, lifted from the "MIME Sniffing" spec.
* @prop {ArrayLike<number>} mimeSniffPatternMask The pattern mask to use for MIME sniffing, lifted from the "MIME Sniffing" spec.
*/
/** @type {SupportedFileType[]} */
export const SUPPORTED_FILE_TYPES = [
{
name: "PNG",
extensions: [".png"],
mimeType: "image/png",
route: "/png",
mimeSniffBytePattern: [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A],
mimeSniffPatternMask: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF],
},
];