Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/creationix/msgpack-js
The msgpack protocol implemented in pure javascript.
https://github.com/creationix/msgpack-js
Last synced: 21 days ago
JSON representation
The msgpack protocol implemented in pure javascript.
- Host: GitHub
- URL: https://github.com/creationix/msgpack-js
- Owner: creationix
- License: mit
- Created: 2010-12-11T11:33:46.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2018-03-05T16:57:01.000Z (over 6 years ago)
- Last Synced: 2024-09-23T01:04:43.849Z (about 2 months ago)
- Language: JavaScript
- Homepage: http://msgpack.org/
- Size: 38.1 KB
- Stars: 253
- Watchers: 11
- Forks: 48
- Open Issues: 14
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
Awesome Lists containing this project
- awesome-nodejs-pure-js - msgpack-js
README
# msgpack for JavaScript
[![node support](https://travis-ci.org/creationix/msgpack-js.png)](https://travis-ci.org/creationix/msgpack-js)
[![browser support](https://ci.testling.com/creationix/msgpack-js.png)](https://ci.testling.com/creationix/msgpack-js)
A handwritten msgpack encoder and decoder for Node.JS and modern browsers.
The original format can be found at
## Extension
I've extended the format a little to allow for encoding and decoding of `undefined` and `Buffer` instances.
This required three new type codes that were previously marked as "reserved".
This change means that using these new types will render your serialized data
incompatible with other messagepack implementations that don't have the same
extension.There are two new types for storing node `Buffer` instances. These work just
like "raw 16" and "raw 32" except they are node buffers instead of strings.buffer 16 11011000 0xd8
buffer 32 11011001 0xd9Also I've added a type for `undefined` that works just like the `null` type.
undefined 11000100 0xc4
## Usage
``` javascript
var msgpack = require('msgpack-js');
var assert = require('assert');var initial = {Hello: "World"};
var encoded = msgpack.encode(initial);
var decoded = msgpack.decode(encoded);assert.deepEqual(initial, decoded);
```