Socket
Socket
Sign inDemoInstall

msgpack5

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

msgpack5

A msgpack v5 implementation for node.js and the browser, with extension points


Version published
Maintainers
1
Created

What is msgpack5?

The msgpack5 npm package is a JavaScript implementation of the MessagePack serialization format. MessagePack is an efficient binary serialization format that enables data exchange between different languages and environments. The msgpack5 package allows you to encode and decode data in the MessagePack format, making it useful for applications that require efficient data serialization and deserialization.

What are msgpack5's main functionalities?

Encoding Data

This feature allows you to encode JavaScript objects into the MessagePack binary format. The code sample demonstrates encoding a simple object with a key-value pair.

const msgpack = require('msgpack5')();
const encoded = msgpack.encode({ foo: 'bar' });
console.log(encoded);

Decoding Data

This feature allows you to decode MessagePack binary data back into JavaScript objects. The code sample shows encoding an object and then decoding it back to its original form.

const msgpack = require('msgpack5')();
const encoded = msgpack.encode({ foo: 'bar' });
const decoded = msgpack.decode(encoded);
console.log(decoded);

Custom Types

This feature allows you to register custom types for encoding and decoding. The code sample demonstrates how to register the Date type and encode/decode it using MessagePack.

const msgpack = require('msgpack5')();
msgpack.register(0x42, Date, (date) => +date, (timestamp) => new Date(timestamp));
const encoded = msgpack.encode(new Date());
const decoded = msgpack.decode(encoded);
console.log(decoded);

Other packages similar to msgpack5

Keywords

FAQs

Package last updated on 02 Oct 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc