baml.csv.reader

A streaming reader over in-memory text or bytes, or an open file handle.

Reference version

Signature

function baml.csv.reader(
source: string | uint8array | baml.fs.File,
options: baml.csv.ReaderOptions | null = …

A streaming reader over in-memory text or bytes, or an open file handle.

A string or uint8array source is CSV content, parsed in place. A baml.fs.File source is streamed from its current cursor to EOF, and the reader owns that cursor from construction until it is exhausted or closed.

The handle is not adopted: close() on the reader leaves the file open, because you opened it and something else may still want it. Use open when you want the reader to own the file instead.

Throws

  • Error { kind: Options } if options is invalid. Nothing is parsed here — the first record is read lazily, on the first next(), rows, or headers.

Source:<builtin>/baml/ns_csv/csv.bamlbytes 32272–32437