Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

307
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda