/** * File Organizer MCP Server v3.4.2 * Content Analyzer Service - Phase 1 * Detects true file types using magic numbers and file signatures */ export interface ContentAnalysisResult { filePath: string; detectedType: string; mimeType: string; confidence: number; extensionMatch: boolean; warnings: string[]; } export interface FileTypeDetection { type: string; mimeType: string; signatures: Buffer[]; extensions: string[]; category: FileCategory; isExecutable: boolean; description: string; } type FileCategory = "document" | "image" | "video" | "audio" | "archive" | "executable" | "script" | "code" | "font" | "database" | "unknown"; export declare class ContentAnalyzerService { private readonly maxHeaderSize; private readonly signatures; constructor(customSignatures?: FileTypeDetection[]); /** * Analyze a file by reading its header and detecting true file type */ analyze(filePath: string): Promise; /** * Read the first 4KB of a file for analysis */ private readFileHeader; /** * Detect file type based on magic numbers/signatures */ detectFileType(buffer: Buffer): FileTypeDetection; /** * Find all signature matches in the buffer */ private findSignatureMatches; /** * Check if buffer starts with a given signature */ private bufferStartsWith; /** * Calculate confidence score based on signature specificity */ private calculateSignatureConfidence; /** * Get specificity weight based on file category */ private getSpecificityWeight; /** * Check if a buffer represents a text file */ private isTextFile; /** * Detect specific text file type based on content */ private detectTextFileType; /** * Check if file extension matches detected content type */ checkExtensionMismatch(filePath: string, detectedType: string): boolean; /** * Calculate confidence score for detection */ getConfidenceScore(detection: FileTypeDetection): number; /** * Generate security warnings based on analysis */ private generateWarnings; /** * Check if buffer contains a pattern anywhere */ private bufferContains; /** * Check if a pattern is expected for the detected file type */ private isExpectedPattern; /** * Calculate severity of extension mismatch */ private calculateMismatchSeverity; /** * Get all supported file types */ getSupportedTypes(): FileTypeDetection[]; /** * Add custom file signature */ addSignature(signature: FileTypeDetection): void; /** * Check if a file is potentially dangerous */ isPotentiallyDangerous(detection: FileTypeDetection): boolean; } export declare const contentAnalyzer: ContentAnalyzerService; export {}; //# sourceMappingURL=content-analyzer.service.d.ts.map