Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

msgpack-lite

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

msgpack-lite

Fast Pure JavaScript MessagePack Encoder and Decoder

  • 0.1.26
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.7M
increased by8.84%
Maintainers
1
Weekly downloads
 
Created

What is msgpack-lite?

The msgpack-lite npm package is a library for encoding and decoding data in MessagePack format, which is a binary serialization format that is compact and efficient. It is often used for communication between different programming languages, as well as for storing and transmitting data in a space-efficient manner.

What are msgpack-lite's main functionalities?

Encoding JavaScript objects to MessagePack format

This feature allows you to take a JavaScript object and encode it into a MessagePack binary buffer, which can then be sent over a network or saved to disk.

const msgpack = require('msgpack-lite');
const object = { hello: 'world' };
const encoded = msgpack.encode(object);

Decoding MessagePack buffers to JavaScript objects

This feature allows you to take a MessagePack binary buffer and decode it into a JavaScript object, which can then be used within your application.

const msgpack = require('msgpack-lite');
const buffer = Buffer.from([0x81, 0xA5, 0x68, 0x65, 0x6C, 0x6C, 0x6F, 0xA5, 0x77, 0x6F, 0x72, 0x6C, 0x64]);
const decoded = msgpack.decode(buffer);

Stream encoding and decoding

This feature provides streaming support for encoding and decoding operations, which is useful for handling large datasets or streaming data over a network.

const msgpack = require('msgpack-lite');
const fs = require('fs');
const encodeStream = msgpack.createEncodeStream();
const decodeStream = msgpack.createDecodeStream();

fs.createReadStream('input.msgpack')
  .pipe(decodeStream)
  .on('data', console.log);

fs.createWriteStream('output.msgpack')
  .pipe(encodeStream);
encodeStream.write({ hello: 'world' });
encodeStream.end();

Other packages similar to msgpack-lite

Keywords

FAQs

Package last updated on 14 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