/** * Core Filesystem Operations - Absolute Path Support + Binary Formats * * Provides low-level file operations anywhere on disk with security validation. * Extends beyond project-relative paths to enable true Desktop Commander parity. * * Supported Formats: * - Text: UTF-8, line-based pagination * - Excel: .xlsx, .xls, .xlsm (JSON 2D array) * - PDF: .pdf (text extraction + metadata) * - Images: .png, .jpg, .webp, .gif, .avif, .tiff (metadata + transformations) * - Archives: .zip, .tar, .gz, .tgz (contents listing + extraction) * - Video: .mp4, .mov, .avi, .mkv, .webm (metadata + thumbnails) */ import { type ExcelSheetInfo } from './formats/excel.js'; import { type ImageMetadata, type ImageWriteOptions } from './formats/image.js'; import { type ArchiveContents } from './formats/archive.js'; import { type VideoMetadata } from './formats/video.js'; import { type FileTypeInfo } from './formats/magic-bytes.js'; export interface FileInfo { path: string; size: number; createdAt: Date; modifiedAt: Date; isDirectory: boolean; isFile: boolean; permissions: string; sheets?: ExcelSheetInfo[]; imageMetadata?: ImageMetadata; archiveContents?: ArchiveContents; videoMetadata?: VideoMetadata; fileType?: FileTypeInfo; textMetadata?: { lineCount: number; lastLine: number; appendPosition: number; encoding?: string; }; } export interface DirectoryListing { path: string; entries: Array<{ name: string; path: string; type: 'file' | 'directory' | 'symlink' | 'other'; size?: number; }>; totalItems: number; } export interface ReadOptions { encoding?: BufferEncoding; offset?: number; length?: number; sheet?: string | number; range?: string; imageMode?: 'metadata' | 'base64'; } export interface WriteOptions { encoding?: BufferEncoding; mode?: 'rewrite' | 'append'; createDirs?: boolean; sheet?: string; imageOptions?: ImageWriteOptions; } export interface SearchOptions { pattern: string; searchType?: 'files' | 'content'; caseSensitive?: boolean; includeHidden?: boolean; filePattern?: string; maxDepth?: number; maxResults?: number; } /** * Path Validation - Prevent directory traversal and malicious paths */ export declare class PathValidator { private static readonly FORBIDDEN_PATTERNS; private static readonly WINDOWS_RESERVED; /** * Normalize path to absolute, resolve symlinks, validate security */ static normalizePath(inputPath: string): Promise; /** * Validate path is within allowed directories (if configured) * For now, we'll accept any valid path. Can be restricted later via config. */ static validateAccess(normalizedPath: string): Promise; } /** * Read file contents with format detection and optional transformations * * Supported formats: * - Text: Line-based pagination (offset/length) * - Excel: JSON 2D array (sheet/range selection) * - PDF: Text extraction + metadata * - Images: Metadata extraction (width/height/format) * - Archives: Contents listing (files/directories) * - Video: Metadata (duration/resolution/codec) */ export declare function readFileAbsolute(filePath: string, options?: ReadOptions): Promise; /** * Write file contents with format detection and transformations * * Supported formats: * - Text: Append/rewrite modes * - Excel: JSON 2D array → Excel file * - Images: Buffer → Image with optional resize/convert */ export declare function writeFileAbsolute(filePath: string, content: string, options?: WriteOptions): Promise; /** * List directory contents with metadata */ export declare function listDirectoryAbsolute(dirPath: string, options?: { recursive?: boolean; maxDepth?: number; }): Promise; /** * Get file/directory metadata with format-specific details */ export declare function getFileInfo(filePath: string): Promise; /** * Check if path exists */ export declare function pathExists(filePath: string): Promise; /** * Delete file or directory */ export declare function deletePath(targetPath: string, options?: { recursive?: boolean; }): Promise; /** * Copy file or directory */ export declare function copyPath(sourcePath: string, destPath: string, options?: { recursive?: boolean; }): Promise; /** * Move/rename file or directory */ export declare function movePath(sourcePath: string, destPath: string): Promise; /** * Read multiple files in a single operation * Failures for individual files don't stop the batch */ export declare function readMultipleFiles(filePaths: string[], options?: ReadOptions): Promise>; /** * Search for files or content recursively * Supports filename patterns and content search */ export declare function searchFiles(rootPath: string, options: SearchOptions): Promise; }>>; //# sourceMappingURL=core.d.ts.map