0.0.2 • Published 3 years ago

buffer2address v0.0.2

Weekly downloads
4
License
LGPL 2.1
Repository
github
Last release
3 years ago

node-buffer2address

Node.js module to retrieve memory address of Buffer

About

This tiny module allows to retrieve the memory address of a Node.js Buffer as a BigInt. This address can be used for interoperability with native code.

Installation

npm install buffer2address

or

yarn add buffer2address

API

buffer2address(buf) => BigInt

Returns the address of a Node.js buffer instance as a BigInt. On 32-bit systems we could actually return a Number but to be consistent over all architectures always BigInts are returned.

Example

import buffer2address from "buffer2address";

const buf = Buffer.alloc(32);
console.log(`buffer address = ${buffer2address(buf)}`);