A plugin for file-type that detects audio and video file formats. This plugin helps differentiate between audio and video file types more precisely.
npm install @file-type/avHere’s how to use this plugin with file-type to detect audio/video formats:
import { fileTypeFromFile } from 'file-type';
import { detectAv } from '@file-type/av';
const fileType = await fileTypeFromFile('example.mka', {
customDetectors: [detectAv]
});
console.log(JSON.stringify(fileType, null, 2));audio/matroska–.mkavideo/matroska–.mkv
audio/mp4–.m4avideo/mp4–.mp4
audio/ogg; codecs=opus–.opus(Opus)audio/ogg; codecs=speex–.spx(Speex)audio/ogg; codecs=vorbis–.ogg(Vorbis)video/ogg–.ogv(Theora)
audio/webm–.webmvideo/webm–.webm
audio/x-ms-asf–.wmavideo/x-ms-asf–.wmv
Licensed under the MIT License. You are free to use, modify, and distribute this project as needed.