const fs = require('fs')
const path = require('path')
fs와 path 모듈은 Node.js에 포함되어있기 때문에 따로 설치할 필요는 없다.
const getCsvData = (filename) => {
const csvPath = path.join(__dirname, '.', filename + '.csv') // 두번째 인
const csv = fs.readFileSync(csvPath, "utf-8")
...
}
var allRows = csv.split(/\n|\r/)
rowData = []
for(var singleRow = 0; singleRow < allRows.length; singleRow++) {
var rowCells = allRows[singleRow].split(',')
if(singleRow === 0) {
...
}
rowData.push(rowCells)
}
console.log(rowData)