Last active
November 5, 2021 03:08
-
-
Save balinux/e9944f28a4a655c6bf9890d6890d94e2 to your computer and use it in GitHub Desktop.
contoh cara memebaca file csv di nodejs
This file contains 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 csv = require('csv-parser'); | |
// const fs = require('fs'); | |
// const results = []; | |
fs.createReadStream('../../example/message_kuisioner.csv') | |
.pipe(csv()) | |
// .on('data', (row) => { | |
// console.log(row); | |
// }) | |
.on('data', (data) => results.push(data)) | |
.on('end', () => { | |
console.log('CSV file successfully processed'); | |
console.log(results); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment