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.
Type Parameters
Section titled “Type Parameters”T
extends AnyStruct
The schema type extending AnyStruct
Parameters
Section titled “Parameters”schema
Section titled “schema”T
Effect Schema used to validate and decode each JSON line
config
Section titled “config”Configuration object
folder
Section titled “folder”string
Path to the directory containing JSONL files
Returns
Section titled “Returns”LoaderReturn
<T
>
A Stream of validated objects matching the schema type, one per line
Throws
Section titled “Throws”When no JSONL files are found, parsing fails, or validation fails
Example
Section titled “Example”const LogSchema = Schema.Struct({ timestamp: Schema.String, message: Schema.String,});
const logs = jsonLinesLoader(LogSchema, { folder: './logs' });