/** * CSV Formatter Stream * * True streaming CSV formatter using cross-platform stream module. * Works identically in both Node.js and Browser environments. */ import { Transform } from "../../stream/index.js"; import type { CsvFormatOptions, Row } from "../types.js"; /** * Transform stream that formats rows to CSV * * @example * ```ts * const formatter = new CsvFormatterStream({ headers: ['name', 'age'] }); * formatter.pipe(writable); * formatter.write(['Alice', 30]); * formatter.write(['Bob', 25]); * formatter.end(); * ``` */ export declare class CsvFormatterStream extends Transform { private options; /** Unified format configuration (shared with batch formatter) */ private formatConfig; private headerWritten; /** Keys to access data from source objects */ private keys; /** Headers to write to output (may differ from keys) */ private displayHeaders; /** Index of source row (before filtering), passed to transform.row */ private sourceRowIndex; /** Index of output data row (after filtering, excludes header), used for ctx.index */ private outputRowIndex; /** Pre-allocated options object to avoid per-row allocation in streaming */ private rowOptions; push: (chunk: string | null) => boolean; write: { (chunk: Row, callback?: (error?: Error | null) => void): boolean; (chunk: Row, encoding?: string, callback?: (error?: Error | null) => void): boolean; }; constructor(options?: CsvFormatOptions); /** * Auto-detect keys/headers from a row (object or RowHashArray) */ private detectHeadersFromRow; _transform(chunk: Row, _encoding: string, callback: (error?: Error | null, data?: string) => void): void; _destroy(error: Error | null, callback: (error: Error | null) => void): void; _flush(callback: (error?: Error | null) => void): void; private formatAndPush; private formatRow; } /** * Create formatter stream factory */ export declare function createCsvFormatterStream(options?: CsvFormatOptions): CsvFormatterStream;