2.1.0 • Published 4 months ago

ffi-wrapper v2.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

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-wrapper
pnpm add ffi-wrapper
yarn add ffi-wrapper

Deno

deno add npm:ffi-wrapper

Bun

bun add ffi-wrapper

📖 Documentation

For more information, please refer to the documentation.

📄 License

This project is licensed under the MIT License.

2.1.0

4 months ago

2.0.0

4 months ago

1.0.1

4 months ago

1.0.0

4 months ago