# oer-utils

> Tools for OER parsing and serialization

Latest version **5.1.3-alpha.2** (published 2022-09-28) · 0 weekly downloads

## Install

```sh
npm install oer-utils
pnpm add oer-utils
yarn add oer-utils
bun add oer-utils
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.1.3-alpha.2 |
| Published | 2022-09-28 |
| First published | 2016-08-06 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 103.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | interledger |

## Links

- npm: https://www.npmjs.com/package/oer-utils
- npm.io page: https://npm.io/package/oer-utils

## Dependencies (2)

- [long](https://npm.io/package/long.md) ^4.0.0
- [@types/long](https://npm.io/package/@types/long.md) 4.0.2

## Recent versions

- 5.1.3-alpha.2 (latest) — 2022-09-28
- 5.1.3-alpha.1 — 2022-05-04
- 5.1.3-alpha.0 — 2022-04-27
- 5.1.2 — 2020-07-27
- 5.1.0-alpha.0 — 2019-10-08
- 5.0.1 — 2019-08-29
- 5.0.0 — 2019-08-26
- 4.0.0 — 2018-11-29
- 3.2.0 — 2018-11-02
- 3.1.1 — 2018-10-18
- 3.1.0 — 2018-10-17
- 3.0.1 — 2018-08-22
- 2.0.1 — 2018-03-29
- 2.0.0 — 2018-03-12
- 1.3.4 — 2017-10-25
- … 8 more at https://npm.io/package/oer-utils/versions

## README

# OER Utils

[![npm][npm-image]][npm-url]

[npm-image]: https://img.shields.io/npm/v/oer-utils.svg?style=flat
[npm-url]: https://npmjs.org/package/oer-utils

> Collection of tools for OER parsing and serialization

## Usage

```sh
npm install oer-utils
```

## Numbers in `oer-utils`

This module uses the [`long`](https://github.com/dcodeIO/long.js) library to avoid issues with JavaScript numbers.

`Writer` methods for writing integers, like `writeUInt8` or `writeVarInt`, accept numbers, strings, or `Long`s.

The `Reader` exposes methods for reading integers that return strings, such as `readInt16` and `readVarUInt`, as well as methods that return `Long`s, such as `readInt16Long` and `readVarUIntLong`.

Note that if the `long` API changes, there will be breaking changes to the `read...Long` methods. These methods may be used to avoid unnecessary string conversions, but they may be less stable in the long term than the methods that export strings.

## Examples

### Parse a binary buffer

```js
const Reader = require('oer-utils/reader')

const reader = Reader.from(new Buffer('1234', 'hex'))

const v1 = reader.readUInt8()
const v2 = reader.readUInt8Long()
```

### Write a binary file

```js
const Writer = require('oer-utils/writer')
const Long = require('long')

const writer = new Writer()

writer.writeUInt8(1)
writer.writeUInt8(Long.fromNumber(2, true))

const buffer = writer.getBuffer()
```

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