Skip to content

How to read base64 csv file? #442

Open

Description

@kuriel-trivu

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.

Activity

  1. jfoclpf commented on Apr 22, 2022

    @jfoclpf

    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')
      })
  2. kuriel-trivu commented on Apr 22, 2022

    @kuriel-trivu
    Author

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

  3. jfoclpf commented on Apr 22, 2022

    @jfoclpf

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions