Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

iobuffer

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iobuffer

Read and write binary data on ArrayBuffers

  • 1.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
50K
decreased by-11.73%
Maintainers
1
Weekly downloads
 
Created
Source

iobuffer

NPM version build status Test coverage npm download

Read and write binary data in ArrayBuffers

Installation

$ npm install iobuffer

API

Buffer

InputBuffer and OutputBuffer both inherit from Buffer which defines the following interface:

buffer

Reference to the internal ArrayBuffer object.

length

Byte length of the internal ArrayBuffer object.

available(byteLength = 1)

Returns true if there are enough bytes between the current offset and the buffer's end, false otherwise.

setBigEndian() / setLittleEndian()

Set the endianess for multi-byte values (default is little endian).

isBigEndian() / isLittleEndian()

Returns a boolean indicating if current endianess matches.

littleEndian

true if current endianess is little endian, false if it is big endian.

offset

Value of the current pointer offset.

skip(n = 1)

Move the pointer forward by n bytes.

seek(offset)

Move the pointer at the given offset.

mark()

Store the current pointer offset.

reset()

Move the pointer back to the last offset stored by mark.

rewind()

Move the pointer back to offset 0.

InputBuffer

new InputBuffer(data)

data can be an ArrayBuffer or any Typed Array (including Node.js' Buffer from v4).

Methods

Each method returns the value and moves the pointer forward by the number of read bytes.

  • readBoolean
  • readInt8
  • readUint8 / readByte / readBytes(n)
  • readInt16
  • readUint16
  • readInt32
  • readUint32
  • readFloat32
  • readFloat64
  • readChar / readChars(n)

License

MIT

FAQs

Package last updated on 26 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc