🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
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)

latest
Source
npmnpm
Version
0.0.20250210
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 4.0 installed at /usr/local/lib/libmemif.so.

API Example

import { Memif } from "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.
  // Fragmented messages with MEMIF_BUFFER_FLAG_NEXT are concatenated.
});

// Writable side of the stream allows transmitting packets.
// It accepts Uint8Array or Buffer.
// If packet is longer than dataroom, it is fragmented with MEMIF_BUFFER_FLAG_NEXT.
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.

Keywords

memif

FAQs

Package last updated on 11 Feb 2025

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