customuintxarray
v0.2.0
Published
Uint1Array up to Uint8Array Based on Typed Array. Useful for compression.
Maintainers
Readme
CustomUintXArray Library Documentation
Introduction
This library provides custom classes for dealing with unsigned integers arrays of varying bit-lengths ranging from Uint1Array to Uint8Array.
Installing the Library
npm install customuintxarrayImporting the Library
Browser
// Use the file located in /dist/index.min.js for proper polyfill support (pre-Chrome 61.0)
var Uint1ArrayCustom = window.Uint1ArrayCustom;NodeJS
// Use the file located in / for compatibility with code processors like Babel
import { Uint1ArrayCustom } from "customuintxarray";Available:
Uint1ArrayCustom
Uint2ArrayCustom
Uint3ArrayCustom
Uint4ArrayCustom
Uint5ArrayCustom
Uint6ArrayCustom
Uint7ArrayCustom (Example)
Constructor
new Uint7ArrayCustom(s)s: Size of the array or an instance of Uint8Array or Uint8ClampedArray.
Properties
a: Returns the underlying Uint8Array.
Methods
read(index): Read a 7-bit integer at the given index.
write(index, value): Write a 7-bit integer at the given index.
Uint8ArrayCustom (Same but doesn't have a padding value)
Common Properties and Methods
Properties
length: Returns the length of the array.
bits: Returns the number of bits each integer in the array occupies.
As for the context, this library provides a structured, performant way to work with varying bit-length integers. It gives more control over the bit-level representation of numbers, which can be crucial for tasks that require high-performance or low-level data manipulation.
