shared-node-buffer

1.2.3 • Public • Published

shared-node-buffer

Node shared buffer class for fast sharing data between processes (Windows/OSX/Linux supported).

linux ci osx ci windows ci Version License

About

The SharedNodeBuffer class library provides Node.js class that utilise memory mapped files for fast low-level inter-process communication (IPC).

Install

> npm install shared-node-buffer --save

Example

const cluster = require("cluster");
const SharedNodeBuffer = require("shared-node-buffer");
const buffer = new SharedNodeBuffer("your key", 1024 * 1024);

if (cluster.isMain) {
  buffer.write("Hello World!");
  cluster.fork();
} else {
  console.log(buffer.slice(0, 64).toString());
}

API

SharedNodeBuffer proxys the most Buffer.prototype's method, you can find at Node.js Buffer Doc.

Package Sidebar

Install

npm i shared-node-buffer

Weekly Downloads

1

Version

1.2.3

License

MIT

Unpacked Size

16.6 kB

Total Files

12

Last publish

Collaborators

  • zyeros