@via-org/avsc
TypeScript icon, indicating that this package has built-in type declarations

6.1.8 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @via-org/avsc

Weekly Downloads

6

Version

6.1.8

License

none

Unpacked Size

33.4 kB

Total Files

9

Last publish

Collaborators

  • hbauer