@lobehub/chat
Version:
Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.
22 lines (16 loc) • 464 B
text/typescript
import { formatSize } from '../format';
const VIDEO_SIZE_LIMIT = 20 * 1024 * 1024; // 20MB in bytes
export interface VideoValidationResult {
actualSize?: string;
isValid: boolean;
}
export const validateVideoFileSize = (file: File): VideoValidationResult => {
if (!file.type.startsWith('video/')) {
return { isValid: true };
}
const isValid = file.size <= VIDEO_SIZE_LIMIT;
return {
actualSize: formatSize(file.size),
isValid,
};
};