oer-utils v5.1.3-alpha.2
OER Utils
Collection of tools for OER parsing and serialization
Usage
npm install oer-utilsNumbers in oer-utils
This module uses the long library to avoid issues with JavaScript numbers.
Writer methods for writing integers, like writeUInt8 or writeVarInt, accept numbers, strings, or Longs.
The Reader exposes methods for reading integers that return strings, such as readInt16 and readVarUInt, as well as methods that return Longs, 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
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
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()3 years ago
3 years ago
3 years ago
5 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago