Comparing version 2.3.13 to 2.3.14
@@ -7,2 +7,9 @@ # Changelog | ||
#### Koffi 2.3.14 | ||
**Main changes:** | ||
- Add `koffi.errno()` function to get and set current errno value | ||
- Add `koffi.os.errno` object with valid errno codes | ||
#### Koffi 2.3.13 | ||
@@ -9,0 +16,0 @@ |
@@ -104,1 +104,23 @@ # Miscellaneous | ||
You can use `koffi.stats()` to get a few statistics related to Koffi. | ||
## POSIX error codes | ||
*New in Koffi 2.3.14* | ||
You can use `koffi.errno()` to the current errno value, and `koffi.errno(value)` to change it. | ||
The standard POSIX error codes are available in `koffi.os.errno`, as in the example below: | ||
```js | ||
const assert = require('assert'); | ||
const koffi = require('koffi'); | ||
const lib = koffi.load('libc.so.6'); | ||
const close = lib.func('int close(int fd)'); | ||
close(-1); | ||
assert.equal(koffi.errno(), koffi.os.errno.EBADF); | ||
console.log('close() with invalid FD is POSIX compliant!'); | ||
``` |
{ | ||
"name": "koffi", | ||
"version": "2.3.13", | ||
"stable": "2.3.13", | ||
"version": "2.3.14", | ||
"stable": "2.3.14", | ||
"description": "Fast and simple C FFI (foreign function interface) for Node.js", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -134,4 +134,11 @@ // Copyright 2023 Niels Martignène <niels.martignene@protonmail.com> | ||
export let internal: Boolean; | ||
export let extension: String; | ||
export function errno(): number; | ||
export function errno(value: number): number; | ||
export const internal: Boolean; | ||
export const extension: String; | ||
export const os: { | ||
errno: Record<string, number> | ||
}; | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 21 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 21 instances in 1 package
17465435
359
6454