csv/parse-stream: syntax error handling
- Dominant language
- TypeScript
- Stars
- 3.6k
- Forks
- 681
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
I want to watch a CSV file and recompute some statistics each time it changes. Sometimes the last record is incomplete:
```
Error: Syntax error on line 156: The record has 2 fields, but the header has 4 fields
```
**Describe the solution you'd like**
A way to handle syntax errors and continue parsing the stream rather than throwing and halting stream parsing.
e.g. `onSyntaxError()` option to the `CsvParseStream` constructor. The function can return a completed record or return something like `undefined` to skip the record.
**Describe alternatives you've considered**
Building my own stream transforming to detect an incomplete last line and not pipe it through to the `CsvParseStream` instance.
Contributor guide
Assessment
This issue has not been assessed yet.