1
0
Fork 0
mirror of https://github.com/codedread/bitjs synced 2025-10-03 09:39:16 +02:00

Add WOFF, WOFF2 to file sniffer

This commit is contained in:
Jeff Schiller 2023-02-16 20:51:25 -08:00
parent 244dfed5d9
commit 2eb77ef59c
2 changed files with 8 additions and 2 deletions

View file

@ -8,7 +8,7 @@
*/
// A Container Format is a file that embeds multiple data streams into a single file.
// Relevant examples:
// Examples:
// 1) the ISO-BMFF family (MP4, HEVC, AVIF, MOV/QT, etc)
// 2) the Matroska family (MKV, WebM)
// 3) the RIFF family (WAV, AVI, WebP)
@ -66,6 +66,10 @@ const fileSignatures = {
],
'audio/wav': [[0x52, 0x49, 0x46, 0x46, '??', '??', '??', '??', 0x57, 0x41, 0x56, 0x45]], // 'RIFF....WAVE'
'video/avi': [[0x52, 0x49, 0x46, 0x46, '??', '??', '??', '??', 0x41, 0x56, 0x49, 0x20]], // 'RIFF....AVI '
// Miscellaneous.
'font/woff': [[0x77, 0x4F, 0x46, 0x46]], // 'wOFF'
'font/woff2': [[0x77, 0x4F, 0x46, 0x32]], // 'wOF2'
};
// TODO: Eventually add support for various container formats so that:
@ -102,7 +106,7 @@ let maxDepth = 0;
export function initialize() {
root = new Node();
// Construct the tree, erroring if overlapping mime types are possible.
// Construct the tree, erroring if overlapping mime types are found.
for (const mimeType in fileSignatures) {
for (const signature of fileSignatures[mimeType]) {
let curNode = root;