function readCsvSync(filename, options) { const fs = require('fs'); const parse = require('csv-parse/lib/sync'); const content = fs.readFileSync(filename).toString(); return parse(content, options); } const options = { columns: true, comment: '#' }; const records = readCsvSync('sample.csv', options); /* [ { fruit: 'apple' }, { fruit: 'orange' }, { fruit: 'lemon' } ] */ const options = { columns: [