2.1.0 • Published 8 months ago
ffi-wrapper v2.1.0
FFI Wrapper
This library provides a lightweight, optimized and simple way to invoke FFI calls to libs in NodeJS, Deno and Bun. It abstracts the FFI API from each runtime into a single unified one.
import { open, suffix, Types } from "ffi-wrapper";
// Automatically complete the suffix depending on the operating system (.dll, .so, .dylib)
const lib = `lib.${suffix}`;
const ffi = open(lib, {
add: {
params: [Types.Int32, Types.Int32],
returns: Types.Int32,
},
});
console.log(ffi.symbols.add(1, 2)); // Output: 3🚀 Installation
You can install this library using the following commands for each runtime:
NodeJS
npm install ffi-wrapperpnpm add ffi-wrapperyarn add ffi-wrapperDeno
deno add npm:ffi-wrapperBun
bun add ffi-wrapper📖 Documentation
For more information, please refer to the documentation.
📄 License
This project is licensed under the MIT License.