https://github.com/devongovett/coffeepack
An implementation of the MessagePack serialization format in CoffeeScript for Node.js and the browser.
https://github.com/devongovett/coffeepack
Last synced: 12 months ago
JSON representation
An implementation of the MessagePack serialization format in CoffeeScript for Node.js and the browser.
- Host: GitHub
- URL: https://github.com/devongovett/coffeepack
- Owner: devongovett
- Created: 2011-08-15T17:22:49.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2011-11-09T06:06:30.000Z (over 14 years ago)
- Last Synced: 2025-03-16T12:51:26.530Z (over 1 year ago)
- Language: CoffeeScript
- Homepage: https://github.com/devongovett/coffeepack
- Size: 136 KB
- Stars: 49
- Watchers: 4
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
CoffeePack
----------
An implementation of the MessagePack serialization format in CoffeeScript for Node.js and the browser.
[MessagePack](http://msgpack.org/) is a binary-based object serialization library. It's like JSON
but much more space efficient.
## Node Installation
npm install coffeepack
## Browser Installation
// Use the MsgPack global variable as shown below...
## Usage
While CoffeePack is written in CoffeeScript, it can be used from both CoffeeScript and plain 'ol JavaScript.
There are two methods provided by coffeepack, `pack` and `unpack`.
var MsgPack = require('coffeepack'),
assert = require('assert');
var object = {
foo: "bar",
baz: [1, 2, 3],
person: {
firstName: 'Devon',
lastName: 'Govett'
}
}
assert.deepEqual(MsgPack.unpack(MsgPack.pack(object)), object);
By default, `MsgPack.pack` returns a binary string, but if you'd like an array of bytes instead, just
pass `true` as the second argument.
`MsgPack.unpack` expects either an array of bytes or a binary string and returns a JavaScript object.
## LICENSE
CoffeePack is licensed under the MIT LICENSE.