npm.io
1.0.9 • Published 8 years ago

@lukaswozniak/binarytypes

Licence
ISC
Version
1.0.9
Deps
3
Size
22 kB
Vulns
0
Weekly
0

BinaryTypes

BinaryTypes is a library with classes representing binary data types like bool, int, uint or string.

Installation

$ npm install @lukaswozniak/binarytypes

Usage

import { Bool, UInt32 } from "@lukaswozniak/binarytypes"

// create objects
const trueBoolean = new Bool(true);
const falseBoolean = new Bool(Buffer.from([0]));
const uint = new UInt32(12345);
const uint2 = new UInt32(Buffer.from([0x39, 0x30]));

// read values
const trueValue: boolean = trueBoolean.value;
const value12345: number = uint.value;
const data12345: Buffer = uint.data;

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

ISC