
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
csv streaming parser to JSON.
npm install csvstream
var csvstream = require('csvstream');
var fs = require('fs');
var rs = fs.createReadStream('./test/test1.csv');
var ws_head = fs.createWriteStream('./test/output2.json');
var csvs = new csvstream({header: true}, function(err, result) {
if(err)
console.error(err);
console.log(result);
// [
// { aaa: '1', bbb: '2', ccc: '3' },
// { aaa: '4', bbb: '5', ccc: '6' },
// { aaa: '7', bbb: '8', ccc: '9' }
// ])
});
rs.pipe(csvs).pipe(ws_head);
Options are optional.
utf8
,
\n
\"
false
Raw data
"aaa","bbb","ccc"
1, 2, 3
4, 5, 6
7, 8, 9
header
equals false you get:
[
["aaa","bb\"\"b","ccc"]
,["1","2","3"]
,["4","5","6"]
,["7","8","9"]
]
header
equals true you get:
[
{"aaa":"1","bbb":"2","ccc":"3"}
,{"aaa":"4","bbb":"5","ccc":"6"}
,{"aaa":"7","bbb":"8","ccc":"9"}
]
Lint your csv files https://github.com/chilijung/csvlint.js before parsing :)
var csvstream = require('../csvstream');
var csvlint = require('csvlint');
var fs = require('fs');
var rs = fs.createReadStream('./benchmark/100000.csv');
var ws = fs.createWriteStream('./benchmark/output2.json');
var csvlint = csvlint();
var csvs = csvstream({header: true});
csvlint.on('finish', function() {
console.log('csv lint is end');
})
csvs.on('finish', function() {
console.log('csv stream is end')
})
rs.pipe(csvlint).pipe(csvs).pipe(ws);
npm test
https://github.com/klaemo/csv-stream
MIT
FAQs
csv streaming parser
We found that csvstream 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
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.