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

koffi

Package Overview
Dependencies
Maintainers
1
Versions
224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koffi - npm Package Compare versions

Comparing version 2.7.1 to 2.7.2

6

CHANGELOG.md

@@ -7,2 +7,8 @@ # Changelog

#### Koffi 2.7.2 (2024-01-15)
- Add missing TypeScript declaration for `koffi.free()`
- Fix TypeScript declaration of `koffi.encode()`
- Try to improve compatibility with webpack
#### Koffi 2.7.1 (2024-01-02)

@@ -9,0 +15,0 @@

4

doc/unions.md

@@ -52,4 +52,4 @@ # Union values

DoSomething('int', { .i = 42 });
DoSomething('string', { .str = 'Hello!' });
DoSomething('int', { i: 42 });
DoSomething('string', { str: 'Hello!' });
```

@@ -56,0 +56,0 @@

@@ -135,3 +135,2 @@ // Copyright 2023 Niels Martignène <niels.martignene@protonmail.com>

export function call(value: any, type: TypeSpec, ...args: any[]): any;
export function encode(ref: any, type: TypeSpec): void;
export function encode(ref: any, type: TypeSpec, value: any): void;

@@ -155,2 +154,4 @@ export function encode(ref: any, type: TypeSpec, value: any, len: number): void;

export function free(value: any): void;
export function errno(): number;

@@ -157,0 +158,0 @@ export function errno(value: number): number;

@@ -72,5 +72,5 @@ "use strict";

let suffix = buf.toString("hex").padStart(8, "0");
let filename = `${prefix}.${suffix}`;
let file = fs2.createWriteStream(filename, { flags: "wx", mode: 420 });
return [filename, file];
let filename2 = `${prefix}.${suffix}`;
let file = fs2.createWriteStream(filename2, { flags: "wx", mode: 420 });
return [filename2, file];
} catch (err) {

@@ -82,4 +82,4 @@ if (err.code != "EEXIST")

}
function extract_targz(filename, dest_dir, strip = 0) {
let reader = fs2.createReadStream(filename).pipe(zlib.createGunzip());
function extract_targz(filename2, dest_dir, strip = 0) {
let reader = fs2.createReadStream(filename2).pipe(zlib.createGunzip());
return new Promise((resolve, reject) => {

@@ -124,9 +124,9 @@ let header = null;

if (header.type == "0" || header.type == "7") {
let filename2 = dest_dir + "/" + header.filename;
let dirname = path.dirname(filename2);
let filename3 = dest_dir + "/" + header.filename;
let dirname = path.dirname(filename3);
fs2.mkdirSync(dirname, { recursive: true, mode: 493 });
fs2.writeFileSync(filename2, data, { mode: header.mode });
fs2.writeFileSync(filename3, data, { mode: header.mode });
} else if (header.type == "5") {
let filename2 = dest_dir + "/" + header.filename;
fs2.mkdirSync(filename2, { recursive: true, mode: header.mode });
let filename3 = dest_dir + "/" + header.filename;
fs2.mkdirSync(filename3, { recursive: true, mode: header.mode });
} else if (header.type == "L") {

@@ -239,6 +239,6 @@ extended.filename = data.toString("utf-8").replace(/\0/g, "");

}
function read_file_header(filename, read) {
function read_file_header(filename2, read) {
let fd = null;
try {
let fd2 = fs2.openSync(filename);
let fd2 = fs2.openSync(filename2);
let buf = Buffer.allocUnsafe(read);

@@ -385,4 +385,4 @@ let len = fs2.readSync(fd2, buf);

name: "koffi",
version: "2.7.1",
stable: "2.7.1",
version: "2.7.2",
stable: "2.7.2",
description: "Fast and simple C FFI (foreign function interface) for Node.js",

@@ -535,2 +535,5 @@ keywords: [

if (native == null) {
let roots = [__dirname];
if (process.resourcesPath != null)
roots.push(process.resourcesPath);
let names = [

@@ -541,15 +544,12 @@ `/build/koffi/${process.platform}_${arch}/koffi.node`,

];
for (let name of names) {
if (fs.existsSync(__dirname + name)) {
native = require(__dirname + name);
break;
}
}
if (native == null && process.resourcesPath != null) {
for (let root of roots) {
for (let name of names) {
if (fs.existsSync(process.resourcesPath + name)) {
native = require(process.resourcesPath + name);
let filename = root + name;
if (fs.existsSync(filename)) {
native = eval("require")(filename);
break;
}
}
if (native != null)
break;
}

@@ -556,0 +556,0 @@ }

@@ -72,5 +72,5 @@ "use strict";

let suffix = buf.toString("hex").padStart(8, "0");
let filename = `${prefix}.${suffix}`;
let file = fs2.createWriteStream(filename, { flags: "wx", mode: 420 });
return [filename, file];
let filename2 = `${prefix}.${suffix}`;
let file = fs2.createWriteStream(filename2, { flags: "wx", mode: 420 });
return [filename2, file];
} catch (err) {

@@ -82,4 +82,4 @@ if (err.code != "EEXIST")

}
function extract_targz(filename, dest_dir, strip = 0) {
let reader = fs2.createReadStream(filename).pipe(zlib.createGunzip());
function extract_targz(filename2, dest_dir, strip = 0) {
let reader = fs2.createReadStream(filename2).pipe(zlib.createGunzip());
return new Promise((resolve, reject) => {

@@ -124,9 +124,9 @@ let header = null;

if (header.type == "0" || header.type == "7") {
let filename2 = dest_dir + "/" + header.filename;
let dirname = path.dirname(filename2);
let filename3 = dest_dir + "/" + header.filename;
let dirname = path.dirname(filename3);
fs2.mkdirSync(dirname, { recursive: true, mode: 493 });
fs2.writeFileSync(filename2, data, { mode: header.mode });
fs2.writeFileSync(filename3, data, { mode: header.mode });
} else if (header.type == "5") {
let filename2 = dest_dir + "/" + header.filename;
fs2.mkdirSync(filename2, { recursive: true, mode: header.mode });
let filename3 = dest_dir + "/" + header.filename;
fs2.mkdirSync(filename3, { recursive: true, mode: header.mode });
} else if (header.type == "L") {

@@ -239,6 +239,6 @@ extended.filename = data.toString("utf-8").replace(/\0/g, "");

}
function read_file_header(filename, read) {
function read_file_header(filename2, read) {
let fd = null;
try {
let fd2 = fs2.openSync(filename);
let fd2 = fs2.openSync(filename2);
let buf = Buffer.allocUnsafe(read);

@@ -385,4 +385,4 @@ let len = fs2.readSync(fd2, buf);

name: "koffi",
version: "2.7.1",
stable: "2.7.1",
version: "2.7.2",
stable: "2.7.2",
description: "Fast and simple C FFI (foreign function interface) for Node.js",

@@ -455,2 +455,5 @@ keywords: [

{
let roots = [__dirname];
if (process.resourcesPath != null)
roots.push(process.resourcesPath);
let names = [

@@ -461,15 +464,12 @@ `/build/koffi/${process.platform}_${arch}/koffi.node`,

];
for (let name of names) {
if (fs.existsSync(__dirname + name)) {
native = require(__dirname + name);
break;
}
}
if (native == null && process.resourcesPath != null) {
for (let root of roots) {
for (let name of names) {
if (fs.existsSync(process.resourcesPath + name)) {
native = require(process.resourcesPath + name);
let filename = root + name;
if (fs.existsSync(filename)) {
native = eval("require")(filename);
break;
}
}
if (native != null)
break;
}

@@ -476,0 +476,0 @@ }

{
"name": "koffi",
"version": "2.7.1",
"stable": "2.7.1",
"version": "2.7.2",
"stable": "2.7.2",
"description": "Fast and simple C FFI (foreign function interface) for Node.js",

@@ -6,0 +6,0 @@ "keywords": [

@@ -28,5 +28,5 @@ # Overview

You can consult the [changelog](https://koffi.dev/changes) on the official website.
You can consult the [changelog](https://koffi.dev/changelog) on the official website.
Major version increments can include breaking API changes, use the [migration guide](https://koffi.dev/changes#migration-guide) for more information.
Major version increments can include breaking API changes, use the [migration guide](https://koffi.dev/changelog#migration-guide) for more information.

@@ -33,0 +33,0 @@ # License

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

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

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

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

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