/** * csvSuperPro — Multi-threaded CSV parser (Pro tier). * * Extends csvSuper() with: * ✅ Worker Threads for parallel parsing (N × faster on multi-core) * ✅ Transform pipeline (type coercion, filtering, enrichment) * ✅ License verification (online + offline JWT fallback) * * Architecture: * Main Thread * ├─ LicenseChecker.verify() * ├─ Split file into N byte ranges * ├─ ThreadPool.initialize() * └─ ThreadPool.process() → yields ordered BatchResults * * Worker Thread (×N) * ├─ Reads byte range via fs.createReadStream * ├─ CsvParser (independent FSM per thread) * ├─ Optional transform function * └─ Posts BatchResult messages to main thread * * Memory model: * Each thread uses ~50MB (same as free tier per thread). * Total memory = ~50MB × N threads (acceptable for typical machines). * The speed benefit (N× throughput) far outweighs the memory cost. */ import type { CsvSuperProOptions, BatchResult } from '../types/index.js'; /** * Pro-tier CSV parser with multi-thread acceleration. * * @param filePath Path to the CSV file. * @param options Pro options including `licenseKey` and `threads`. * @yields {BatchResult} Ordered batches of parsed (and transformed) rows. * * @throws {LicenseError} When the license key is invalid or expired. * @throws {ThreadError} When a worker thread fails. * @throws {ParseError} When the CSV content is malformed. * * @example * ```typescript * import { csvSuperPro, TransformPipeline } from 'csv-super'; * * const pipeline = new TransformPipeline() * .filter((row) => row.status === 'active') * .mapField('age', (v) => String(parseInt(v, 10))) * .trim(); * * for await (const batch of csvSuperPro('employees.csv', { * licenseKey: process.env.CSV_SUPER_KEY!, * threads: 8, * batch: 5000, * transform: pipeline.toFn(), * })) { * await db.employees.insertMany(batch.rows); * console.log(`Processed ${batch.totalSoFar} rows`); * } * ``` */ export declare function csvSuperPro(filePath: string, options: CsvSuperProOptions): AsyncGenerator; export { TransformPipeline } from './transform-pipeline.js'; //# sourceMappingURL=multi-thread.d.ts.map