Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

306
Views
How to deserialize avro file in react

Can anyone help me to deserialize the avro file in react? I tried with avsc npm package but I am now stuck on error.

const avro = require('avsc')
......
avro.createFileDecoder('./abc.avro').on('data', (record) => { console.log(record) })
......

but it shows an error.

TypeError: avro.createFileDecoder is not a function

How to solve this???

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

That error was because the createFileDecoder function requires another parameter { codecs } Anyway, I read the avro file with createBlobDecoder. This is what I did.

let metadata = null;
let rows = [];
avro
  .createBlobDecoder(file)
      .on("metadata", type => {
          metadata = type;
      })
      .on("data", val => {            
          rows.push(val);
      })
      .on("end", () => {
          console.log(metadata);
          console.log(rows);       
      });

Here, file is the default return value of an input tag in HTML.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!