Last active
March 28, 2020 06:39
-
-
Save SuvamPrasd/1e3c7e016531d21f3431b506acbf04d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const csvFilePath = 'customer-data.csv'; | |
const uuidv1 = require('uuid/v1'); | |
const fs = require('fs'); | |
const path = require('path'); | |
const csv = require('csvtojson'); | |
csv().fromFile(csvFilePath).then((jsonObj)=>{ | |
let buff = '' | |
let folderName = uuidv1(); | |
fs.mkdirSync(folderName); | |
buff = JSON.stringify(jsonObj); | |
fs.writeFileSync(path.join(__dirname, folderName, 'resultJSON.json'), buff); | |
// console.log(jsonObj); | |
console.log('Coverting completed'); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment