bun:ffi module to call the Zinc C ABI directly. No native addon compilation is needed. Bun loads libzinc_core at runtime through its FFI layer.
Installation
Build the core from a source checkout, then set up the adapter:SharedRegion
create
open
buffer
Returns aBuffer backed by the shared memory mapping. Uses bun:ffi’s toBuffer function for zero-copy access.
notify
wait
true on notification, false on timeout.
close
Symbol.dispose for using statements:
Complete example
FFI details
Handles are numeric pointers in Bun’s FFI API.zinc_ptr returns the data pointer and toBuffer wraps it without copying. The loader resolves target/release/libzinc_core.{so,dylib} relative to the source checkout.
Keep the region open while any returned buffer is in use. close() is idempotent and later operations on the region throw. tryWait() consumes a pending notification without blocking. Timeouts must be integers between 0 and 2^32 - 1 milliseconds.