Comments (1)
@markericson Did you end up finding a solution to this? I'm looking for the same. I tried using on('headers', (headers) => headers.map(transformStuffHere))
but that doesn't appear to affect the actual headers used while processing.
Update - You can use the .preFileLine()
hook to transform the headers you already have by checking for index === 0
https://github.com/Keyang/node-csvtojson?tab=readme-ov-file#csv-file-line-hook
However! This seems to be a little buggy. On a test file with just one row of headers and one row of data, I was seeing both lines logging an index of 0. Adding more rows to my CSV and the issue changed. Could absolutely be user error, but just in case be wary of it mutating your rows
from node-csvtojson.
Related Issues (20)
- How to get a single record?
- json
- ignoreEmpty: true and checkType: true does not work if set output is csv format HOT 2
- It does not create an array of objects when using a ReadStream of CSV HOT 1
- String types which contain a number prefixed by zero are incorrectly detected
- When header has ".", it creates inner objects
- Node's types should not be imported for module to be used in browser HOT 2
- Several comma's prevent csv() identify fields in text
- Vulnerable dependencies (indirect security issues)
- colParser giving error by passing undefined.
- Reduce published npm package size
- feat: stream iterator
- Empty CSV or CSV with just Headers creates an invalid JSON
- api to get only headers
- csvtojson : The term 'csvtojson' is not recognized as the name of a cmdlet, function, script file, or operable program.
- New tagged version 2.0.11 is not available on the npmjs.com server
- bluebird
- Bluebird causes js/incomplete-sanitization high security vulnerability
- How to auto-detect encoding of csv file?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-csvtojson.