Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to read base64 csv file? #442

Open
kuriel-trivu opened this issue Mar 29, 2022 · 3 comments
Open

How to read base64 csv file? #442

kuriel-trivu opened this issue Mar 29, 2022 · 3 comments

Comments

@kuriel-trivu
Copy link

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.

@jfoclpf
Copy link

jfoclpf commented Apr 22, 2022

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')
  })

@kuriel-trivu
Copy link
Author

kuriel-trivu commented Apr 22, 2022

@jfoclpf Bro, title Is VERY specific. From base64 string, you passed a path file.

@jfoclpf
Copy link

jfoclpf commented Apr 22, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants