FFI Plugin management library featuring automatic caching of local and remote binaries, cross-platform automatic url guessing, deno_plugin_prepare backwards compatibility and pretty deno-like logging when caching and downloading binaries.
⚠️ FFI in deno is unstable and undergoing BREAKING CHANGES. This library aims to follow changes to deno as closly as possible.
import { Plug } from "https://deno.land/x/plug/mod.ts";
// Backwards compatibility with deno-plugin-prepare
const options: Plug.Options = {
name: "test_lib",
urls: {
darwin: `https://example.com/some/path/libtest_lib.dylib`,
windows: `https://example.com/some/path/test_lib.dll`,
linux: `https://example.com/some/path/libtest_lib.so`,
},
};
// Or if you want plug to guess your binary names
const options: Plug.Options = {
name: "test_lib",
url: "https://example.com/some/path/",
// Becomes:
// darwin: "https://example.com/some/path/libtest_lib.dylib"
// windows: "https://example.com/some/path/test_lib.dll"
// linux: "https://example.com/some/path/libtest_lib.so"
};
// Drop-in replacement for `Deno.dlopen`
const library = await Plug.prepare(options, {
noop: { parameters: [], result: "void" },
});
library.symbols.noop();
- deno_plugin_prepare - A library for managing deno native plugin dependencies
- cache - Deno cache library
Pull request, issues and feedback are very welcome. Code style is formatted with
deno fmt
and commit messages are done following Conventional Commits spec.
Copyright 2020-2021, the denosaurs team. All rights reserved. MIT license.