@openade/fe
Version:
Fatturazione Elettronica - Electronic Invoicing for Sistema di Interscambio (SDI)
50 lines • 1.82 kB
TypeScript
import type { IStorage } from './storage.interface';
export interface AttachmentConfig {
fileStorage: IStorage;
maxFileSize?: number;
allowedExtensions?: string[];
storageDir?: string;
compression?: boolean;
encryption?: boolean;
}
export interface Attachment {
id: string;
filename: string;
content: string;
mimeType: string;
size: number;
hash: string;
description?: string;
createdAt: string;
compressed?: boolean;
encrypted?: boolean;
}
export interface AttachmentResult {
id: string;
success: boolean;
error?: string;
attachment?: Attachment;
}
export declare class AttachmentManager {
private config;
private compressionService;
private encryptionService;
constructor(config: AttachmentConfig);
addAttachmentFromFile(filePath: string, description?: string): Promise<AttachmentResult>;
addAttachment(content: Buffer, filename: string, mimeType: string, description?: string): Promise<AttachmentResult>;
getAttachment(id: string): Promise<Attachment | null>;
removeAttachment(id: string): Promise<boolean>;
listAttachments(): Promise<Attachment[]>;
private validateAttachment;
private generateAttachmentId;
private calculateHash;
private getMimeType;
private storeAttachment;
private loadAttachment;
private deleteAttachment;
private listStoredAttachments;
}
export declare function createAttachmentManager(config: AttachmentConfig): AttachmentManager;
export declare function addInvoiceAttachment(filePath: string, description: string | undefined, config: AttachmentConfig): Promise<AttachmentResult>;
export declare function getInvoiceAttachment(id: string, config: AttachmentConfig): Promise<Attachment | null>;
//# sourceMappingURL=attachments.manager.d.ts.map