Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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: 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.
The npm package incremental-csv-parser receives a total of 2,542 weekly downloads. As such, incremental-csv-parser popularity was classified as popular.
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.