1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-10 08:10:18 +00:00
musix-oss/node_modules/bytebuffer
2020-03-03 22:30:50 +02:00
..
dist Modules 2020-03-03 22:30:50 +02:00
externs Modules 2020-03-03 22:30:50 +02:00
node_modules/long Modules 2020-03-03 22:30:50 +02:00
scripts Modules 2020-03-03 22:30:50 +02:00
src Modules 2020-03-03 22:30:50 +02:00
tests Modules 2020-03-03 22:30:50 +02:00
.npmignore Modules 2020-03-03 22:30:50 +02:00
.travis.yml Modules 2020-03-03 22:30:50 +02:00
bower.json Modules 2020-03-03 22:30:50 +02:00
bytebuffer.png Modules 2020-03-03 22:30:50 +02:00
donate.png Modules 2020-03-03 22:30:50 +02:00
index.js Modules 2020-03-03 22:30:50 +02:00
jsdoc.json Modules 2020-03-03 22:30:50 +02:00
LICENSE Modules 2020-03-03 22:30:50 +02:00
package.json Modules 2020-03-03 22:30:50 +02:00
README.md Modules 2020-03-03 22:30:50 +02:00

bytebuffer.js - The swiss army knife for binary data in JavaScript.

A fast and complete ByteBuffer implementation using either ArrayBuffers in the browser or node Buffers under node.js, generated from a single source tree through MetaScript.

Build Status Donate

Features

  • Three API-compatible versions:
    • bytebuffer   Backing buffer: ArrayBuffer, Accessor: Uint8Array
    • bytebuffer-dataview   Backing buffer: ArrayBuffer, Accessor: DataView
    • bytebuffer-node   Backing buffer / Accessor: node Buffer
  • 8, 16, 32 and 64 bit (through long.js) signed and unsigned integers
  • 32 and 64 bit floats
  • Varints as used in protobuf (32 and 64 bit, zig-zag)
  • Base64, utf8, binary, hex and debug encodings
  • Handy string and debugging utilities
  • Big and little endianness
  • Relative and absolute zero-copy operations wherever possible
  • Transparent resizing when using unknown-length data
  • Chaining of all operations that do not return a specific value
  • Slicing, appending, prepending, reversing, flip, mark, reset, etc.

Usage

The library is compatible with CommonJS and AMD loaders and is exposed globally as dcodeIO.ByteBuffer if neither is available.

var ByteBuffer = require("bytebuffer");

var bb = new ByteBuffer()
            .writeIString("Hello world!")
            .flip();
console.log(bb.readIString()+" from bytebuffer.js");

In the browser, 64 bit integer support is optional and present only if Long.js has been loaded prior to bytebuffer.js.

API

Downloads

Support for IE<10, FF<15, Chrome<9 etc.

  • Use bytebuffer-dataview with a polyfill (see)

Contributors

Dretch (IE8 compatibility)

License

License: Apache License, Version 2.0 - Logo derived from W3C HTML5 Logos (CC A 3.0)