bun-ffi
Installation
SKILL.md
Bun FFI — Foreign Function Interface
Call C libraries directly from TypeScript with Bun's built-in FFI. 3× faster than previous Bun versions, with native JSC FFI replacing TinyCC.
Quick Reference
| Task | Pattern |
|---|---|
| Load library | dlopen("libname.so", symbols) |
| Call function | lib.fn(args) |
| C string return | returns: "cstring" |
| Buffer + length | args: ["buffer", "buffer_length"] |
| By-value struct | Pack into bigint, use u64 |