/** * 文件实体 */ export declare class FileEntity { id: string; originalName: string; filename: string; mimeType: string; fileType: string; extension: string; size: number; checksum: string; path: string; storageProvider: string; metadata: Record; bucket: string; key: string; etag: string; userId: string; uploadId: string; tempPath: string; status: 'processing' | 'completed' | 'failed' | 'deleted'; errorMessage: string; /** * 验证数据(文件签名检测、类型检测等) */ validationData: { detectedTypes: Array<{ type: string; confidence: number; isCustom: boolean; }>; signatures: Array<{ type: string; bytes: number[]; offset: number; }>; integrityChecks: string[]; }; createdAt: Date; updatedAt: Date; deletedAt: Date; /** * 是否为图片 */ get isImage(): boolean; /** * 是否为文档 */ get isDocument(): boolean; /** * 是否为视频 */ get isVideo(): boolean; /** * 是否为音频 */ get isAudio(): boolean; /** * 是否为CAD文件 */ get isCAD(): boolean; /** * 是否为压缩文件 */ get isArchive(): boolean; /** * 获取人类可读的文件大小 */ get humanSize(): string; /** * 静态方法: 从文件名提取扩展名(使用统一工具类) */ static extractExtension(filename: string): string; /** * 静态方法: 根据 MIME 类型和扩展名识别文件类型 */ static detectFileType(mimeType: string, extension: string): string; /** * 生成访问 URL * 注意:不再使用 getter,改为方法以接收 baseUrl 参数 * 建议使用 FileService.getFileUrl() 代替 * * @param baseUrl 基础 URL(可选) * @returns 文件访问 URL * @deprecated 请使用 FileService.getFileUrl() */ generateUrl(baseUrl?: string): string; /** * 获取完整的物理路径(服务器端使用) * 仅用于服务器端访问文件系统 */ getPhysicalPath(): string; /** * 自动识别并设置文件类型和扩展名 */ detectAndSetFileType(): void; /** * 标记为已完成 */ markAsCompleted(metadata?: any): void; /** * 标记为失败 */ markAsFailed(error: string): void; /** * 标记为已删除 */ markAsDeleted(): void; /** * 添加验证数据 */ addValidationData(data: Partial): void; }