Skip to content

via-org/avsc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

948 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

avsc

A via-specific pure JavaScript implementation of the Avro specification. Used for bundling data.

Features

  • Isomorphic: no reliance on node built-ins

Installation

$ npm install @via-org/avsc
# or
$ yarn add @via-org/avsc

Example

import { createType } from '@via-org/avsc'

export const Tags = createType({
  type: 'array',
  items: createType({
    type: 'record',
    name: 'Tag',
    fields: [
      { name: 'name', type: 'string' },
      { name: 'value', type: 'string' },
    ],
  }),
})

// Encode
const tags = [{ name: 'Tag-Name', value: 'Tag-Value' }]
const encodedTags = Tags.toBuffer(tags) // encodedTags instanceof Uint8Array

// Decode
const decodedTags = Tags.fromBuffer(encodedTags) // decodedTags === tags

About

Avro for JavaScript ⚡

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 99.4%
  • Shell 0.6%