oddcast-msgpack

1.0.1 • Public • Published

oddcast-msgpack

An oddcast utility for msgpack

pipeline status

Install

npm install --save oddcast-msgpack

Usage

const msg = require('oddcast-msgpack');

encode(obj)

Encodes an object into a buffer.

> let encoded = msg.encode({thing: 1, foo: 'bar'})
> buf
<Buffer 82 a5 74 68 69 6e 67 01 a3 66 6f 6f a3 62 61 72>

decode(buf)

Decodes a buffer.

> let decoded = msg.decode(buf)
> decoded
{ thing: 1, foo: 'bar' }

encodeHex(obj)

Encodes an object into a hex string.

> encoded = msg.encodeHex({thing: 1, foo: 'bar'})
> encoded
'82a57468696e6701a3666f6fa3626172'

decodeHex(str)

Decodes a hex string into an object.

> decoded = msg.decodeHex(encoded)
> decoded
{thing: 1, foo: 'bar'}

License

MIT

Package Sidebar

Install

npm i oddcast-msgpack

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

7.36 kB

Total Files

9

Last publish

Collaborators

  • blainsmith
  • brkattk
  • kixxauth
  • oddworks