31 lines
1009 B
JavaScript
31 lines
1009 B
JavaScript
// @ts-check
|
|
|
|
/**
|
|
* @typedef {object} MimeSniffPattern
|
|
* @prop {ArrayLike<number>} bytes The byte pattern to use for MIME sniffing, lifted from the "MIME Sniffing" spec.
|
|
* @prop {ArrayLike<number>} mask The pattern mask to use for MIME sniffing, lifted from the "MIME Sniffing" spec.
|
|
*/
|
|
|
|
/**
|
|
* @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 {MimeSniffPattern[]} mimeSniffPatterns MIME sniffing patterns.
|
|
*/
|
|
|
|
/** @type {SupportedFileType[]} */
|
|
export const SUPPORTED_FILE_TYPES = [
|
|
{
|
|
name: "PNG",
|
|
extensions: [".png", ".apng"],
|
|
mimeType: "image/png",
|
|
route: "/png",
|
|
mimeSniffPatterns: [{
|
|
bytes: [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A],
|
|
mask: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF],
|
|
}],
|
|
},
|
|
];
|