# @via-org/avro

> JavaScript Avro implementation

Latest version **2.0.4** (published 2022-02-16) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @via-org/avro
pnpm add @via-org/avro
yarn add @via-org/avro
bun add @via-org/avro
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; no types.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.4 |
| Published | 2022-02-16 |
| First published | 2022-02-16 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 73.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3316 |
| Author | Avro Developers |
| Maintainers | hbauer |
| Keywords | avro, json |

## Links

- npm: https://www.npmjs.com/package/@via-org/avro
- Repository: https://github.com/apache/avro
- Homepage: https://github.com/apache/avro#readme
- Issues: https://github.com/apache/avro/issues
- npm.io page: https://npm.io/package/@via-org/avro

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.0.4 (latest) — 2022-02-16
- 2.0.3 — 2022-02-16
- 2.0.2 — 2022-02-16

## README

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

# Avro

A via-specific pure JavaScript implementation of the [Avro specification](https://avro.apache.org/docs/current/spec.html). Used for [bundling data](https://github.com/joshbenaron/arweave-standards/blob/ans104/ans/ANS-104.md).

## Features

- Fast! Typically twice as fast as JSON with much smaller encodings.
- Isomorphic: no reliance on node built-ins

## Installation

```bash
$ npm install @via-org/avro
# or
$ yarn add @via-org/avro
```

## Example

```js
// Initialize a schema:
import { parse } from '@via-org/avro'

const tagParser = parse({
  type: 'record',
  name: 'Tag',
  fields: [
    { name: 'name', type: 'string' },
    { name: 'value', type: 'string' },
  ],
})

export const tagsParser = parse({
  type: 'array',
  items: tagParser,
})

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

// Decode
const decodedTags = tagsParser.fromBuffer(Uint8ArrayBuffer) // decodedTags === tags
```

---
_Source: https://npm.io/package/@via-org/avro · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
