Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

193
Views
Is there a "start" like "end" in fs.createreadstream?

I am using csv-parser library, and i want to check table captions before parsing them

const fs = require('fs')
const csv = require('csv-parser')

fs.createReadStream('tes.csv')
        .pipe(csv())
        .on('start', start=>{
            console.log(start)
//here i should check how column names are captioned
        })
        .on('data', data=>{
            console.log(data)
//if they are captioned as requiered i do things
        })

I checked the documentation but didnt find anything about it, so there is something to use like .on('end', ()=>{})? Or there is an other way to get column names?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can get column names with headers event. csv-parser emit headers event after header row parsed. First parameter of callback function is Array[String] and you can access column names or headers . (more doc)

const fs = require('fs')
const csv = require('csv-parser')

fs.createReadStream('tes.csv')
        .pipe(csv())
        .on('headers', headers=>{
            console.log(headers)
        })
        .on('data', data=>{
            console.log(data)
        })
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!