import type { StreamWriter } from './stream.js'; /** * GenericStreamEncoder writes GCF tabular output incrementally as rows arrive. * Zero buffering: each row is written immediately. A trailer summary is * emitted on close() with the final counts. * * @example * ```ts * const enc = new GenericStreamEncoder({ write: (s) => process.stdout.write(s) }); * enc.beginArray('employees', ['id', 'name', 'department', 'salary']); * enc.writeRow([1, 'Alice', 'Engineering', 95000]); * enc.writeRow([2, 'Bob', 'Sales', 72000]); * enc.endArray(); * enc.close(); * ``` */ export declare class GenericStreamEncoder { private readonly writer; private sections; private current; private err; constructor(writer: StreamWriter); /** Start a tabular array section with deferred count [?]. */ beginArray(name: string, fields: string[]): void; /** Start a keyed-map section with deferred count [?:] (SPEC 7.2a). * keyLabel is the key column; valueFields are the value-object fields. Each * writeRow value slice is [keyValue, ...valueFields]. */ beginKeyedMap(name: string, keyLabel: string, valueFields: string[]): void; /** Emit a single pipe-separated row immediately. */ writeRow(values: unknown[]): void; /** Close the current array section and record its count. */ endArray(): void; /** Emit a key=value line immediately. */ writeKV(key: string, value: unknown): void; /** Start a nested object section (## key). */ writeSection(name: string): void; /** Emit a primitive array inline: name[N]: val1,val2,val3 */ writeInlineArray(name: string, values: unknown[]): void; /** Emit the ##! summary trailer with final counts. Must be called after all data. * Throws if a rejected field name (containing ">") was passed to beginArray. */ close(): void; private endArrayInternal; } //# sourceMappingURL=stream_generic.d.ts.map