Avsc
Pure JavaScript implementation of the Avro specification.
What's already there:
- Parsing schemas.
- Encoding, decoding, validating, and generating data.
- Resolving schemas (a.k.a. "reader's schemas").
- Reading container files.
Coming up:
- Writing container files.
- Sort order.
- Canonical schemas and fingerprints.
- Protocols.
Example
var avsc = require('avsc');
var Person = avsc.parse({
type: 'record',
name: 'Person',
fields: [
{name: 'name', type: 'string'},
{name: 'age', type: 'int'}
]
}).getRecordConstructor();
var person = new Person('Ann', 25);
person.name; // == 'Ann'
person.age; // == 25
person.$encode(); // Buffer containing this record's Avro encoding.
Installation
$ npm install avsc