How to use the isValidVideo function

The isValidVideo function is used to check whether an video file is valid or not. It accepts a Buffer as an argument.

Types that are validated

You can also pass an options object as a second argument to exclude a specific type.

import { isValidVideo } from 'multiform-validator';
import VideoBuffer from 'video-buffer';
import VideoBuffer2 from 'video-buffer2';

const buffer: Buffer = VideoBuffer;
const isValid = isValidVideo(buffer);

console.log(isValid);  // true if the video is valid, false otherwise

const buffer2: Buffer = VideoBuffer2;
const isValid2 = isValidVideo(buffer2, { exclude: ['mov'] });

console.log(isValid2);  // true if the video is valid, false otherwise