GitHub - mtth/avsc: Avro for JavaScript :zap:

const type = avro.Type.forSchema({
  type: 'record',
  name: 'Pet',
  fields: [
    {
      name: 'kind',
      type: {type: 'enum', name: 'PetKind', symbols: ['CAT', 'DOG']}
    },
    {name: 'name', type: 'string'}
  ]
});

const buf = type.toBuffer({kind: 'CAT', name: 'Albert'}); // Encoded buffer.
const val = type.fromBuffer(buf); // = {kind: 'CAT', name: 'Albert'}