Code Monkey home page Code Monkey logo

bytebuffer.js's Introduction

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:
    • ByteBufferNB   Backing buffer / Accessor: node Buffer
    • ByteBufferAB   Backing buffer: ArrayBuffer, Accessor: Uint8Array
    • ByteBufferAB_DataView   Backing buffer: ArrayBuffer, Accessor: DataView
  • 8, 16, 32 and 64 bit 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 ByteBufferAB_DataView with a polyfill (see)

Contributors

Dretch (IE8 compatibility)

License

Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.html

bytebuffer.js's People

Contributors

dcodeio avatar kidskilla avatar dretch avatar adambom avatar

Watchers

James Cloos 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.