Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-ffi

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-ffi - npm Package Compare versions

Comparing version 0.3.2 to 0.4.0

12

lib/ffi.js

@@ -7,11 +7,9 @@ var util = require("util");

FFI.Bindings = require("../build/Release/ffi_bindings");
} catch (e) { try {
FFI.Bindings = require("../build/default/ffi_bindings");
} catch (e) {
try {
FFI.Bindings = require("../build/default/ffi_bindings");
} catch (e) {
throw new Error("Cannot find compiled bindings!");
}
}
throw new Error("Cannot find compiled bindings!");
}}
FFI.VERSION = "0.3.2";
FFI.VERSION = "0.4.0";

@@ -18,0 +16,0 @@ FFI.TYPE_TO_POINTER_METHOD_MAP = {

{
"name": "node-ffi",
"version": "0.3.2",
"version": "0.4.0",
"author": "Rick Branson",

@@ -5,0 +5,0 @@ "contributors": [

@@ -378,2 +378,21 @@ var util = require("util");

var p = new FFI.Pointer(128)
, orig = p.seek(0)
var put1 = { test: { equality: true } }
, put2 = { test2: 'does this work?' }
p.putObject(put1, true)
p.putObject(put2, true)
var get1 = orig.getObject(true)
, get2 = orig.getObject(true)
assert.ok(put1 === get1)
assert.ok(put2 === get2)
assert.deepEqual(put1, get1)
assert.deepEqual(put2, get2)
//////////////////////
assert.ok(FFI.Bindings.StaticFunctions instanceof Object);

@@ -672,2 +691,23 @@ assert.ok(FFI.Bindings.StaticFunctions.dlopen instanceof Pointer);

// Test Pointer#toBuffer()
var p = new FFI.Pointer(128)
, b = p.toBuffer()
assert.equal(p.allocated, b.length)
// Test Buffer -> Pointer
b.write('hello\0');
assert.equal(p.getCString(), 'hello')
// Test Pointer -> Buffer
var hw = 'hello world';
p.putCString(hw);
assert.equal(b.slice(0, hw.length).toString(), hw)
// Test modifying a single byte in the Buffer
b[2] = 'L'.charCodeAt(0)
assert.equal(p.getCString(), 'heLlo world')
///////////////////////
util.log("Heap increased by " + ((process.memoryUsage()["rss"] - rss) / 1024) + " KB");

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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