mmapfile

0.1.1 • Public • Published

mmapfile

Node.js addon to map files as shared memory buffers, for unix + windows.

Using mmap is fast and allows shared memory between processes.

Usage:

const mf = require('mmapfile');

// open a file for read/write & map to a Buffer
let wb = mf.openSync("buf.txt", 8, "r+");		
// write to it:
wb.fill('-');

// open the file for read only & map to a Buffer
// (could be in an entirely different process)
let rb = mf.openSync("buf.txt", 8);
console.log(rb.byteLength); // 8
console.log(rb.toString('ascii')); // "--------" 

Readme

Keywords

Package Sidebar

Install

npm i mmapfile

Weekly Downloads

3

Version

0.1.1

License

(MIT OR Apache-2.0)

Unpacked Size

7.92 kB

Total Files

7

Last publish

Collaborators

  • grrrwaaa