New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@metamask/object-multiplex

Package Overview
Dependencies
Maintainers
11
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metamask/object-multiplex

Simple stream multiplexing for objectMode.

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
11
Created

What is @metamask/object-multiplex?

@metamask/object-multiplex is a utility for creating and managing multiple independent streams of data over a single connection. It is particularly useful in scenarios where you need to multiplex several communication channels over a single transport layer, such as in browser extensions or inter-process communication.

What are @metamask/object-multiplex's main functionalities?

Creating a Multiplex Stream

This feature allows you to create a new multiplex stream instance. This instance can be used to manage multiple independent streams over a single connection.

const ObjectMultiplex = require('@metamask/object-multiplex');
const stream = new ObjectMultiplex();

Creating Substreams

This feature allows you to create substreams within the main multiplex stream. Each substream can be used independently to send and receive data.

const ObjectMultiplex = require('@metamask/object-multiplex');
const stream = new ObjectMultiplex();
const substream1 = stream.createStream('substream1');
const substream2 = stream.createStream('substream2');

Sending Data Over Substreams

This feature allows you to send data over a specific substream. The data sent over one substream is isolated from other substreams.

const ObjectMultiplex = require('@metamask/object-multiplex');
const stream = new ObjectMultiplex();
const substream = stream.createStream('substream');
substream.write('Hello, World!');

Receiving Data From Substreams

This feature allows you to receive data from a specific substream. You can set up event listeners to handle incoming data on each substream.

const ObjectMultiplex = require('@metamask/object-multiplex');
const stream = new ObjectMultiplex();
const substream = stream.createStream('substream');
substream.on('data', (data) => {
  console.log('Received data:', data);
});

Other packages similar to @metamask/object-multiplex

FAQs

Package last updated on 14 Oct 2024

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