Package Exports
- bytebuffer
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bytebuffer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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.
What can it do?
- 8, 16, 32 and 64 bit signed and unsigned integers
- 32 and 64 bit floats
- Big and little endianness
- Varints as used in protobuf (32 and 64 bit, zig-zag)
- Base64, binary, debug, hex and utf8 encodings
- Handy string and debugging utilities
- 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.
- Requires working ArrayBuffer & DataView implementations (i.e. use a polyfill)
Contributors
Dretch (IE8 compatibility)
License
Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.html