bytebuffer

The swiss army knife for binary data in JavaScript.

Apache-2.0 68 个版本
安装
npm install bytebuffer
yarn add bytebuffer
pnpm add bytebuffer
bun add bytebuffer
README

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)

版本列表
5.0.1 2016-02-12
5.0.0 2015-10-25
4.1.0 2015-09-26
4.0.0 2015-06-25
3.5.5 2015-06-20
3.5.4 2014-11-03
3.5.3 2014-10-23
3.5.2 2014-10-21
3.5.1 2014-10-21
3.5.0 2014-10-14
3.4.0 2014-10-02
3.3.0 2014-08-26
3.2.3 2014-08-26
3.2.2 2014-08-26
3.2.1 2014-08-25
3.2.0 2014-08-12
3.1.1-1 2014-08-10
3.1.1 2014-08-07
3.1.0 2014-06-28
3.0.3 2014-06-26
3.0.2 2014-06-24
3.0.1 2014-06-18
3.0.0 2014-06-16
3.0.0-RC2 2014-06-05
3.0.0-RC1 2014-06-05
2.3.2 2014-08-12
2.3.1 2013-12-28
2.3.0 2013-12-28
2.2.0 2013-12-27
2.1.1 2013-12-26
2.1.0 2013-12-08
2.0.2 2013-12-06
2.0.1 2013-11-18
2.0.0 2013-11-17
1.6.1 2013-11-10
1.6.0 2013-11-10
1.5.0 2013-10-22
1.4.1 2013-09-30
1.3.8 2013-06-07
1.3.7 2013-06-02
1.3.6 2013-05-21
1.3.5 2013-05-21
1.3.4 2013-05-16
1.3.3 2013-05-12
1.3.2 2013-05-12
1.3.1 2013-04-24
1.3.0 2013-03-20
1.2.3 2013-03-19
1.2.2 2013-03-19
1.2.1 2013-03-19
1.2.0 2013-03-18
1.1.5 2013-03-18
1.1.4 2013-03-17
1.1.3 2013-03-12
1.1.2 2013-03-09
1.1.1 2013-03-06
1.1.0 2013-03-05
1.0.5 2013-03-04
1.0.4 2013-03-04
1.0.3 2013-03-04
1.0.2 2013-03-02
1.0.1 2013-02-28
1.0.0 2013-02-27
0.9.4 2013-02-27
0.9.3 2013-02-27
0.9.1 2013-02-27
0.9.0 2013-02-27
0.0.0 2013-02-27