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

memif

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memif

Shared Memory Packet Interface (memif)

  • 0.0.20210909
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Shared Memory Packet Interface (memif) for Node.js

npm package version GitHub Workflow status GitHub code size

This package is a Node C++ addon of libmemif, which provides high performance packet transmit and receive between Node.js and VPP/DPDK applications. It works on Linux only and requires libmemif installed at /usr/local/lib/libmemif.so.

API Example

const { Memif } = require("memif");

// Memif class is a Node.js Duplex stream.
const memif = new Memif({
  role: "client",
  socketName: "/run/memif.sock",
  id: 0,
  dataroom: 2048,
  ringCapacity: 1024,
});

// Readable side of the stream gives access to received packets.
memif.on("data", (pkt) => {
  // pkt is a Uint8Array containing received packet.
});

// Writable side of the stream allows transmitting packets.
// It accepts ArrayBufferView (including Uint8Array and Buffer) and ArrayBuffer.
memif.send(Uint8Array.of(0x01, 0x02));

// Be sure to close the interface when no longer needed.
memif.close();

Limitations

Each Memif instance must have a distinct socketName.

MEMIF_BUFFER_FLAG_NEXT is not supported.

Keywords

FAQs

Package last updated on 10 Sep 2021

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