How to use avro-js - 3 common examples

To help you get started, we’ve selected a few avro-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github elevy30 / bigdata-playground / spring-boot / spring-boot-avro / src / main / resources / node_avro.js View on Github external
function example() {
    const avro = require('avro-js');

    const snappy = require('snappy'); // Or your favorite Snappy library.
    const codecs = {
        snappy: function (buf, cb) {
            // Avro appends checksums to compressed blocks, which we skip here.
            return snappy.uncompress(buf.slice(0, buf.length - 4), cb);
        }
    };

    fs.createReadStream('iris.avro');

    avro.createFileDecoder('iris.avro', {codecs})
        .on('metadata', function (type) { /* `type` is the writer's type. */ })
        .on('data', function (record) { console.log(record)/* Do something with the record. */ });


}
github elevy30 / bigdata-playground / spring-boot / spring-boot-avro / src / main / resources / node_avro.js View on Github external
function createFileDecoderFromStream(is, opts) {
    return is.pipe(new avro.BlockDecoder(opts));
}

avro-js

JavaScript Avro implementation

Apache-2.0
Latest version published 4 months ago

Package Health Score

89 / 100
Full package analysis