Bustin Base
Bustin Base2y ago

What is the right way to bundle native modules?

If I'm not able to import a native module with the built-in "import" keyword, what is the ideal way to download and cache them? Should I be fetching it? How should I be caching it locally? Should I make an "install" script? What are the general techniques, does anyone have any examples?
3 Replies
Bustin Base
Bustin BaseOP2y ago
Like in this example: https://deno.com/manual@v1.34.3/runtime/ffi_api Suppose the binaries are all pre-built and available for download. How would you recommend "installing" these or pulling them down before runtime?
Deno
Foreign Function Interface | Manual | Deno
As of Deno 1.13 and later, the FFI (foreign function interface) API allows users to call libraries written in native languages that support the C ABIs (C/C++, Rust, Zig, V, etc.) using Deno.dlopen.
dj
dj2y ago
many ffi modules use plug: https://deno.land/x/plug but it fetches at runtime currently there’s no realistic way to install before runtime
Bustin Base
Bustin BaseOP2y ago
Ok very cool, thanks, I'll check that out.