Skip to content

Interface: CsvEncoder()<T>

Defined in: types.ts:217

A prepared encoder. Call it with data to get a CSV string, or use its methods for a single row or for streaming output.

Type Parameters

Type ParameterDefault type
T extends objectCsvRecord
ts
CsvEncoder(data): string;

Defined in: types.ts:219

Encode a list (or any iterable) of records into one CSV string.

Parameters

ParameterType
dataIterable<T>

Returns

string

Methods

row()

ts
row(record): string;

Defined in: types.ts:221

Encode a single record into one CSV line, without a header.

Parameters

ParameterType
recordT

Returns

string


stream()

ts
stream(data): AsyncIterable<string>;

Defined in: types.ts:223

Encode records as an async stream of string chunks.

Parameters

ParameterType
dataIterable<T, any, any> | AsyncIterable<T, any, any>

Returns

AsyncIterable<string>

Released under the MIT License.