A browserify, Pure JS implementation of msgpack spec v5
Want to see pretty graphs? Log in now!
npm install purepack
|6||downloads in the last day|
|44||downloads in the last week|
|429||downloads in the last month|
|Last Published By|
|Version||1.0.0 last updated 7 months ago|
|Dependents||framed-msgpack-rpc, kbpgp, keybase, purepack-v0|
A pure CoffeeScript implemented of Msgpack.
We've made one addition to the spec. When reserved byte
a raw string, the subsequent value is to be interepreted as raw bytes, and
not a UTF-8 string.
To force this behavior on the packing side, feed a Uint8Array to the packer (instead of a regular string). Uint8Arrays will automatically be returned from unpacking.
npm install purepack
Where To Use it
Tested and works with browserify, so
it's useful for packing and unpacking structures on the browser-side. It also works
node processes. In either case, it finds the fastest buffer
objects at its disposal to give you the best performance possible.
Pack an object
After packing, output the result according to the given encoding. Encodings include
buffer— Output as a
buffer.Bufferon node, or a
Uint8Arraybuffer in a browser
base64— Output as a standard base64-encoded string (with
/outputs at positions 62 and 63)
base64a— Output as base64-encoding, with
_characters rather than the
/characters. Better for URLs.
base64x— Output as base64-encoding, with
-characters rather than the
/characters. Better for filenames.
base32— sfs-style base32-encoding
hex— Standard base16/hex encoding
binary— Output as a binary string. Beware, UTF-8 problems ahead!
ui8a— Synonym for
bufferon the browser, or output to a
There are two options currently supported, off by default:
floats— Use floats rather than doubles when encoding. Useful when saving space
byte_arrays— Encode Uint8Arrays differently from UTF-8 strings, using the
0xc4prefix described above.
Unpack a packed object
obj, which has been packed and encoded according to the
encoding. See above for possibilities. Returns a pair
null if the unpacking succeeded, or will be non-null and a description
if there was an unpacking error.
make setup make
make setup make make test
Testing will run a series of scripts on your machine using
node. It also will
ask you to visit a URL with whichever browsers you please to test
browserify and with your browser's buffer objects.