1.1.3 • Published 10 years ago

binny v1.1.3

Weekly downloads
6
License
MIT
Repository
github
Last release
10 years ago

Binny npm.io

Binny is an C++ addon for NodeJS that serializes arrays to blobs. Why? Because it up to 10 times faster than built-in JSON for certain cases.

Installation

$ npm install binny

Blobs

Binny.pack(["a", "bb", "ccc"])

will return:

<Buffer: B1 00 03 00 01 61 00 02 62 62 00 03 63 63 63>

B1 - Version
00 03 - Number of blocks
00 01 - Length of next block
61 - "a"
00 02 - Length of next block
62 62 - "bb"
00 03 - Length of next block
63 63 63 - "ccc"

Numbers are stored as big-endian uint16.

In current version Binny can process only arrays of ascii/utf8 strings!

Perfomance

$ npm run benchmark

Binny is slower than JSON for small arrays (less than 5kb), but it rocks for this kind of data:

Binny.pack: 9933ms
JSON.stringify: 45553ms

Binny.unpack: 6703ms
JSON.parse: 38383ms

(faster is better)

Usage

var Binny = require("binny");

var buffer = Binny.pack(["array", "of", "strings"]);
var arr = Binny.unpack(buffer); //["array", "of", "strings"]

Tests

$ npm test

License

MIT

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

11 years ago

1.0.2

11 years ago

1.0.1

11 years ago

0.2.4

11 years ago

0.2.1

11 years ago

0.2.0

11 years ago

0.1.1

11 years ago