/**
 * Storage Service
 * Unified service for secure file operations, user uploads, and internal data storage
 * Provides path sanitization, validation, and consistent file handling
 */
declare const BASE_DIRS: {
    readonly attachments: string;
    readonly data: string;
    readonly templates: string;
    readonly uploads: string;
    readonly logs: string;
    readonly config: string;
};
export type BaseDirectory = keyof typeof BASE_DIRS;
export interface FileInfo {
    name: string;
    size: number;
    path: string;
    mimeType?: string;
    hash?: string;
    created?: Date;
    modified?: Date;
}
export interface SaveOptions {
    overwrite?: boolean;
    createBackup?: boolean;
    validateContent?: boolean;
}
export interface ReadOptions {
    encoding?: BufferEncoding;
    maxSize?: number;
}
export interface FileUploadOptions {
    maxSize?: number;
    allowedTypes?: string[];
    destination?: string;
    generateUniqueName?: boolean;
    preserveExtension?: boolean;
}
export interface UploadedFile {
    originalName: string;
    filename: string;
    path: string;
    size: number;
    mimetype?: string;
    extension: string;
    hash?: string;
}
export declare class StorageService {
    private initialized;
    private readonly maxFileSize;
    initialize(): Promise<void>;
    /**
     * Sanitize a filename to prevent path traversal attacks
     */
    sanitizeFilename(filename: string): string;
    /**
     * Validate that a path is within the allowed base directory
     */
    isPathSafe(filePath: string, baseDir: string): boolean;
    /**
     * Get the full safe path for a file
     */
    getSafePath(filename: string, category?: BaseDirectory): string;
    /**
     * Save a file securely
     */
    saveFile(content: string | Buffer, filename: string, category?: BaseDirectory, options?: SaveOptions): Promise<FileInfo>;
    /**
     * Read a file securely
     */
    readFile(filename: string, category?: BaseDirectory, options?: ReadOptions): Promise<string | Buffer>;
    /**
     * Delete a file securely
     */
    deleteFile(filename: string, category?: BaseDirectory): Promise<boolean>;
    /**
     * List files in a category
     */
    listFiles(category?: BaseDirectory, pattern?: RegExp): Promise<FileInfo[]>;
    /**
     * Get file info
     */
    getFileInfo(filename: string, category?: BaseDirectory): Promise<FileInfo | null>;
    /**
     * Move file between categories
     */
    moveFile(filename: string, fromCategory: BaseDirectory, toCategory: BaseDirectory): Promise<FileInfo>;
    /**
     * Get available base directories
     */
    getBaseDirectories(): Record<BaseDirectory, string>;
    /**
     * Save a user upload with security checks
     * @param file - File buffer or stream
     * @param originalName - Original filename from user
     * @param options - Upload options
     * @returns Information about the uploaded file
     */
    saveUserUpload(file: Buffer | NodeJS.ReadableStream, originalName: string, options?: FileUploadOptions): Promise<UploadedFile>;
    /**
     * Clean temporary files older than a given age. Falls back to ./temp to
     * preserve the previous middleware behaviour.
     */
    cleanTempFiles(maxAgeMs?: number, tempDir?: string): Promise<number>;
    /**
     * Save internal application data
     * @param data - Data to save
     * @param filename - Filename for the data
     * @param category - Category/directory for the data
     * @param options - Save options
     */
    saveInternalData(data: string | Buffer | object, filename: string, category?: BaseDirectory, options?: SaveOptions): Promise<FileInfo>;
}
export declare function getStorageService(): StorageService;
export declare function getSecureFileHandler(): StorageService;
export { StorageService as SecureFileHandler };
export default StorageService;
//# sourceMappingURL=storageService.d.ts.map