npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

msgpackjs

v0.9.0

Published

very fast pure js msgpack coder

Readme

msgpackjs

Build Status Coverage Status

This is an unmodified fork of the github msgpack-javascript, a very fast pure JavaScript msgpack coder with no dependencies.

The goal is to republish msgpack-javascript, and to track the original closely. I've removed the original test files and 6mb test data, but added some unit tests to spot-check correctness and for code coverage, and wrote this readme. The version numbers differ to allow independent releases; the initial package version is 0.9.0 and is derived from the latest gitub msgpack-javascript, version 1.05 of 2015-02-16 04:04 GMT commit 2cfda99.

My unit tests cover the basics and omit Uint8Array, maps, huge arrays or huge objects, and binary data. There are a couple of failures, -Infinity is decoded as +Infinity and its own encoding of -Infinity it decodes as 0. These are errata to be fixed.

API

pack( item )

Encode the item and return an array containing the encoded item. To obtain the corresponding byte stream, make it into a Buffer:

var msgpack = require('msgpackjs');
var encoded = msgpackjs.pack(object);
var bytes = new Buffer(encoded);

unpack( encoded )

Decode the encoded item in the buffer and return the JavaScript object. The encoded item can be either an array of numbers or a Buffer.

var msgpack = require('msgpackjs');
var decoded = msgpackjs.unpack(bytes);

Benchmark

The results from the included test-benchmark.js. JSON and BSON are included for comparison, they are similar data bundles.

AR: msgpackjs benchmark, packing { a: 1.5, b: 'foo', c: [ 1, 2 ], d: true, e: {} }
qtimeit=0.21.0 node=8.6.0 v8=6.0.287.53 platform=linux kernel=4.14.0-rc5-amd64 up_threshold=false
arch=ia32 mhz=4514 cpuCount=8 cpu="Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz"
name                                speed           rate
msgpack 1.0.2 pack                208,184 ops/sec    416 >>
msgpack-js 0.3.0 encode           230,048 ops/sec    460 >>
bson 1.0.4 serialize              409,762 ops/sec    820 >>>>
qbson 0.0.11 encode             1,068,923 ops/sec   2138 >>>>>>>>>>>
 * msgpackjs pack to Array      2,542,821 ops/sec   5086 >>>>>>>>>>>>>>>>>>>>>>>>>
 * msgpackjs pack to Buffer     1,742,438 ops/sec   3485 >>>>>>>>>>>>>>>>>
JSON.stringify                  1,329,468 ops/sec   2659 >>>>>>>>>>>>>

AR: msgpackjs benchmark, unpacking { a: 1.5, b: 'foo', c: [ 1, 2 ], d: true, e: {} }
qtimeit=0.21.0 node=8.6.0 v8=6.0.287.53 platform=linux kernel=4.14.0-rc5-amd64 up_threshold=false
arch=ia32 mhz=4515 cpuCount=8 cpu="Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz"
name                                speed           rate
msgpack 1.0.2 unpack              483,090 ops/sec    966 >>>>>
msgpack-js 0.3.0 decode         2,818,036 ops/sec   5636 >>>>>>>>>>>>>>>>>>>>>>>>>>>>
bson 1.0.4 deserialize          1,470,989 ops/sec   2942 >>>>>>>>>>>>>>>
qbson 0.0.11 decode             3,164,769 ops/sec   6330 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 * msgpackjs unpack Buffer      2,401,535 ops/sec   4803 >>>>>>>>>>>>>>>>>>>>>>>>
JSON.parse                      1,202,556 ops/sec   2405 >>>>>>>>>>>>

Related Work

  • msgpack-javascript - the original sources to on github
  • msgpackjs - the above in an npm package
  • msgpack - compiled msgpack plugin for nodejs, slow; 2900 KB
  • msgpack-lite - claims to be 90% faster but is even slower than msgpack; 660 KB
  • q-msgpack - my own experimental encoder (no decode); 32 KB
  • msgpack-javascript - a partial functionality package unrelated to the github version, cannot pack objects; 10,188 KB
  • msgpack-js - javascript msgpack coder; 250 KB
  • bson - the official nodejs mongodb BSON format encoder / decoder; 790 KB
  • qbson - experimental fast BSON encoder / decoder; 124 KB
  • qtimeit - accurate benchmarking
  • JSON.stringify - JavaScript built-in