
Security News
ESLint Adds Official Support for Linting HTML
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
incremental-csv-parser
Advanced tools
A fast & lightweight CSV parser with an incremental parsing api. No dependencies; browser compatible. Includes ESM and CJS builds. All column values are strings (numbers and dates will not automatically be parsed).
Fully compatible with rfc4180.
import { parse } from 'incremental-csv-parser';
const results = await parse(`a,b,c,d
1,2,3,4
5,6,7,8
`);
console.log(results);
// [
// { a: '1', b: '2', c: '3', d: '4' },
// { a: '5', b: '6', c: '7', d: '8' },
// ]
import { CSVParser } from 'incremental-csv-parser';
const results = [];
const parser = new CSVParser((row) => {
results.push(row);
});
parser.process('a,b,c,d\n');
parser.process('1,2,3,4\n');
console.log(results.shift()); // { a: '1', b: '2', c: '3', d: '4' }
parser.process('5,6,7,8');
parser.flush();
console.log(results.shift()); // { a: '5', b: '6', c: '7', d: '8' }
If column names are known ahead of time, they can be passed in via generics.
import { CSVParser } from 'incremental-csv-parser';
type ColumnName = 'a' | 'b' | 'c' | 'd';
const results: Array<Record<ColumnName, string>> = [];
const parser = new CSVParser<ColumName>((row) => {
results.push(row);
});
Both the parse
function and CSVParser
class have an optional second argument
for explicitly providing column names for a csv.
import { CSVParser } from 'incremental-csv-parser';
const columns = ['a', 'b', 'c', 'd'];
const results = parse(`1,2,3,4
5,6,7,8`, columns);
console.log(results);
// [
// { a: '1', b: '2', c: '3', d: '4' },
// { a: '5', b: '6', c: '7', d: '8' },
// ]
FAQs
A simple, browser compatible, incremental CSV parser.
We found that incremental-csv-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.