How to deserialize avro in nodejs?

I have an avro file. I want to use nodejs to open and read its schema and iterate through its records. How to do this? The avro libraries I see in nodejs appear to require you to pass in a schema instead of getting the schema out of the .avro file. Also, I want to be able to support arrays, which there does not seem to exist a node library that does (node-avro-io).

My avro/avroschema Contains:

  1. A nested field {a:{suba: vala, subb: vala}}.
  2. An array field {a:["A","B"]}. node-avro-io does not work.

Error I get with node-avro-io:

Avro Invalid Schema Error: Primitive type must be one of: ["null","boolean","int","long","float","double","bytes","string"]; got DependencyNode

If you want to open a file, the following code found here : https://www.npmjs.com/package/node-avro-io will do the trick :

var DataFile = require("node-avro-io").DataFile;

var avro = DataFile.AvroFile();

var reader = avro.open('test.avro', { flags: 'r' });
reader.on('data', function(data) {
    console.log(data);
});