Skip to content

Function: readFirstJsonlRecords()

Makaio Framework


Makaio Framework / ai-adapters-core/node / readFirstJsonlRecords

readFirstJsonlRecords<T>(filePath, maxRecords): Promise<T[]>

Defined in: ../../../adapters/core/src/log-importer/jsonl-parser.ts:241

Read the first N JSON records from a JSONL file.

Optimized for discovery: reads only enough bytes to find maxRecords complete JSON lines, then stops. Uses a small buffer to avoid reading entire large files.

T

string

Absolute path to the JSONL file

number

Maximum number of records to return

Promise<T[]>

Array of parsed JSON records (skips malformed lines)