Skip to content

jsonLinesLoader

jsonLinesLoader<T>(schema, config): LoaderReturn<T>

Defined in: packages/core/src/loaders.ts:102

Loads and parses JSONL (JSON Lines) files from a directory, validating each line against a schema. Each line in the file is treated as a separate JSON object.

T extends AnyStruct

The schema type extending AnyStruct

T

Effect Schema used to validate and decode each JSON line

Configuration object

string

Path to the directory containing JSONL files

LoaderReturn<T>

A Stream of validated objects matching the schema type, one per line

When no JSONL files are found, parsing fails, or validation fails

const LogSchema = Schema.Struct({
timestamp: Schema.String,
message: Schema.String,
});
const logs = jsonLinesLoader(LogSchema, { folder: './logs' });