Socket
Socket
Sign inDemoInstall

msgpack-js

Package Overview
Dependencies
3
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    msgpack-js

msgpack encoder and decoder in pure javascript


Version published
Maintainers
1
Install size
62.9 kB
Created

Readme

Source

msgpack for JavaScript

node support

browser support

A handwritten msgpack encoder and decoder for Node.JS and modern browsers.

The original format can be found at http://wiki.msgpack.org/display/MSGPACK/Format+specification

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  0xd9

Also I've added a type for undefined that works just like the null type.

undefined  11000100  0xc4

Usage

var msgpack = require('msgpack');
var assert = require('assert');

var initial = {Hello: "World"};
var encoded = msgpack.encode(initial);
var decoded = msgpack.decode(encoded);

assert.deepEqual(initial, decoded);

FAQs

Last updated on 22 Jul 2013

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc