node-csvtojson
node-csvtojson copied to clipboard
How to read base64 csv file?
our uploaded file is a base64 encoded string, i think this is very popular nowadays, how to read that kind of files? with this module.
Use node fromStream
method with createReadStream
const fs = require('fs')
const csv = require('csvtojson')
csv()
.fromStream(fs.createReadStream('/path/to/file', { encoding: 'base64' }))
.subscribe((json) => {
console.log(json)
},
(err) => {
throw err
},
() => {
console.log('success')
})
@jfoclpf Bro, title Is VERY specific. From base64 string, you passed a path file.
got it, though IMHO it is not a purpose of this module to do this type of conversions, anyway you can check this
https://stackoverflow.com/questions/48534404/create-readstream-from-base64-encoded-string-by-file