multiform-validator
Version:
Javascript library made to validate, several form fields, such as: email, images, phone, password, cpf etc.
20 lines (19 loc) • 893 B
TypeScript
type VideoMimeType = "mkv" | "mov" | "mp4";
interface OptionsParams {
exclude: VideoMimeType[];
}
/**
* Checks if a given file buffer represents a valid video file.
* @param fileBuffer - The buffer containing the file data.
* @description This function checks the magic numbers of the file buffer to determine if it is a valid video.
* @param options - An object containing the options for the function.
* @param options.exclude - An array of video types to exclude from the validation.
*
* type VideoMimeType = "mkv" | "mov" | "mp4";
*
* If you want to exclude some video types from the validation, you can pass the options
* @example - isValidVideo(fileBuffer, { exclude: ["mov", "mkv"] });
* @returns A boolean indicating whether the file is a valid video.
*/
declare function isValidVideo(fileBuffer: Buffer, options?: OptionsParams): boolean;
export default isValidVideo;