6.1.8 • Published 2 years ago

@via-org/avsc v6.1.8

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

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
6.1.8

2 years ago

6.1.7

2 years ago

6.1.6

2 years ago

6.1.5

2 years ago

6.1.4

2 years ago

6.1.3

2 years ago