Interface NdjsonToCsvStreamOptions

interface NdjsonToCsvStreamOptions {
    delimiter?: string;
    includeHeaders?: boolean;
    renameMap?: Record<string, string>;
    maxRecords?: number;
    preventCsvInjection?: boolean;
    rfc4180Compliant?: boolean;
    schema?: Record<string, any>;
    transform?: (row: Record<string, any>) => Record<string, any>;
    addBOM?: boolean;
}

Properties

delimiter?: string

Delimiter for CSV output (default: ',')

includeHeaders?: boolean

Include headers row (default: true)

renameMap?: Record<string, string>

Rename column headers { oldKey: newKey }

maxRecords?: number

Maximum number of records to process

preventCsvInjection?: boolean

Prevent CSV injection attacks by escaping formulas (default: true)

rfc4180Compliant?: boolean

Ensure RFC 4180 compliance (default: true).

On the way out this picks CRLF line endings. On the way in it selects the tokenizer dialect: the default treats a backslash as ordinary data, the way RFC 4180, Excel, Papa Parse and this library's own browser build do. Set it to false for files written with the MySQL/Postgres convention, where a backslash escapes the character after it.

schema?: Record<string, any>

JSON schema for validation and formatting

transform?: (row: Record<string, any>) => Record<string, any>

Custom transform function for each row

addBOM?: boolean

Add UTF-8 BOM for Excel compatibility (default: true)