Coder Social home page Coder Social logo

bit-data-view's Introduction

BitDataView

With BitDataView you can parse ArrayBuffer!

Inspired by JavaScripts DataView API.


Install

Using npm
npm install bit-data-view
Using yarn
yarn add bit-data-view

API

Constructor

BitDataView(buffer: ArrayBuffer, bitOffset?: number, bitLength?: number)

Creates a new BitDataView object

Instance properties

  • buffer: ArrayBuffer

The ArrayBuffer referenced by this view. Fixed at construction time and thus read only.

  • bitOffset: number

The offset (in bits) of this view from the start of its ArrayBuffer. Fixed at construction time and thus read only.

  • bitLength: number

The length (in bits) of this view from the start of its ArrayBuffer. Fixed at construction time and thus read only.

Instance methods

  • getBit(bitOffset: number): 0 | 1

Gets a bit integer at the specified bit offset from the start of the view.

  • setBit(bitOffset: number, value: 0 | 1): void

Stores a bit integer value at the specified bit offset from the start of the view.

  • getUint8(bitOffset: number): number

Gets a unsigned 8bit integer at the specified bit offset from the start of the view.

  • setUint8(bitOffset: number, value: number): void

Stores a unsigned 8bit integer value at the specified bit offset from the start of the view.

  • getInt8(bitOffset: number): number

Gets a signed 8bit integer at the specified bit offset from the start of the view.

  • setInt8(bitOffset: number, value: number): void

Stores a signed 8bit integer value at the specified bit offset from the start of the view.

  • getUint16(bitOffset: number, littleEndian = false): number

Gets a unsigned 16bit integer at the specified bit offset from the start of the view.

  • setUint16(bitOffset: number, value: number, littleEndian = false): void

Stores a unsigned 16bit integer value at the specified bit offset from the start of the view.

  • getInt16(bitOffset: number, littleEndian = false): number

Gets a signed 16bit integer at the specified bit offset from the start of the view.

  • setInt16(bitOffset: number, value: number, littleEndian = false): void

Stores a signed 16bit integer value at the specified bit offset from the start of the view.

  • getUint32(bitOffset: number, littleEndian = false): number

Gets a unsigned 32bit integer at the specified bit offset from the start of the view.

  • setUint32(bitOffset: number, value: number, littleEndian = false): void

Stores a unsigned 32bit integer value at the specified bit offset from the start of the view.

  • getInt32(bitOffset: number, littleEndian = false): number

Gets a signed 32bit integer at the specified bit offset from the start of the view.

  • setInt32(bitOffset: number, value: number, littleEndian = false): void

Stores a signed 32bit integer value at the specified bit offset from the start of the view.

  • getBigUint64(bitOffset: number, littleEndian = false): bigint

Gets a unsigned 64bit integer at the specified bit offset from the start of the view.

  • setBigUint64(bitOffset: number, value: number, littleEndian = false): void

Stores a unsigned 64bit integer value at the specified bit offset from the start of the view.

  • getBigInt64(bitOffset: number, littleEndian = false): bigint

Gets a signed 64bit integer at the specified bit offset from the start of the view.

  • setBigInt64(bitOffset: number, value: number, littleEndian = false): void

Stores a signed 64bit integer value at the specified bit offset from the start of the view.

  • getFloat32(bitOffset: number, littleEndian = false): number

Gets a signed 32bit float at the specified bit offset from the start of the view.

  • setFloat32(bitOffset: number, value: number, littleEndian = false): void

Stores a signed 32bit float value at the specified bit offset from the start of the view.

  • getFloat64(bitOffset: number, littleEndian = false): number

Gets a signed 64bit float at the specified bit offset from the start of the view.

  • setFloat64(bitOffset: number, value: number, littleEndian = false): void

Stores a signed 64bit float value at the specified bit offset from the start of the view.


Progress

Function Implemented Tested
constructor 100% 100%
buffer (getter) 100% 100%
bitOffset (getter) 100% 100%
bitLength (getter) 100% 100%
getBit 100% 100%
setBit 100% 100%
getUint8 100% 100%
setUint8 100% 100%
getInt8 100% 100%
setInt8 100% 100%
getUint16 100% 100%
setUint16 0% 0%
getInt16 100% 0%
setInt16 0% 0%
getUint32 100% 0%
setUint32 0% 0%
getInt32 100% 0%
setInt32 0% 0%
getBigUint64 100% 0%
setBigUint64 0% 0%
getBigInt64 0% 0%
setBigInt64 0% 0%
getFloat32 100% 0%
setFloat32 100% 0%
getFloat64 0% 0%
setFloat64 0% 0%

bit-data-view's People

Contributors

freehuntx avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.