@ooneex/csv is a small, streaming CSV reader built on top of Bun. It parses CSV files line by line into typed records, handles quoted fields and custom separators, lets you skip rows by pattern, and can convert a file directly to JSON or YAML without loading everything into memory.
Installation
Add the package with Bun.Usage
Create aCsv instance with a file path and iterate rows with the async generator load. The first row is treated as the header and each subsequent row becomes an object keyed by those headers. You can pass a type parameter for typed rows.
,, ;, :, |, or \t).
ignore option. Each key maps to a pattern, and matching rows are excluded from iteration.
ignore filter.
CsvException you can catch and inspect.
When to use it
- You need to process large CSV files row by row without buffering the whole file in memory.
- You want typed records out of a CSV with a header row, including support for quoted fields and escaped quotes.
- You import data using non-comma separators (semicolon, tab, pipe, colon).
- You need to filter out unwanted rows by pattern, or batch-convert CSV to JSON/YAML files.
- You don’t need it for tiny, well-formed CSV strings you already have in memory, where a quick
splitis enough; this package targets file-based, streamed reading and requires the Bun runtime.