safeer-pdf-generator
Version:
Framework-agnostic PDF generation library with chunking, merging, S3 upload, and email delivery
49 lines • 1.62 kB
TypeScript
import { PdfGenerationOptions, TemplateCompilerFunction, LoggingAdapter, HooksConfig } from '../types.js';
import { PdfEngine } from './PdfEngine.js';
/**
* Coordinates the processing of data chunks into PDF buffers
*/
export declare class ChunkCoordinator {
private readonly logger;
private readonly hooks;
constructor(logger?: LoggingAdapter, hooks?: HooksConfig);
/**
* Process data into chunks and generate PDF buffers
*/
processChunks(options: PdfGenerationOptions, templateCompiler: TemplateCompilerFunction, pdfEngine: PdfEngine): Promise<Buffer[]>;
/**
* Process data as a single chunk
*/
private processSingleChunk;
/**
* Prepare options with enhanced features like logo processing
*/
private prepareChunkOptions;
/**
* Calculate optimal chunk configuration based on data size and system resources
*/
static calculateOptimalChunking(dataLength: number, availableMemoryMB?: number): {
chunkSize: number;
maxConcurrency: number;
enabled: boolean;
};
/**
* Estimate memory usage for chunk processing
*/
static estimateMemoryUsage(_dataLength: number, chunkSize: number, maxConcurrency: number, avgRowSizeKB?: number): {
estimatedMB: number;
recommendation: string;
};
/**
* Validate chunk configuration
*/
static validateChunkConfig(config: {
chunkSize?: number;
maxConcurrency?: number;
dataLength: number;
}): {
valid: boolean;
errors: string[];
};
}
//# sourceMappingURL=ChunkCoordinator.d.ts.map