Skip to main content
The Deno adapter uses Deno.dlopen to load the Zinc shared library. Like the Bun adapter, no native addon is needed. The FFI bindings are defined at runtime in TypeScript.

Installation

Build the core from a source checkout, then set up the adapter:

SharedRegion

create

Creates a new region. Throws on failure.

open

Opens an existing region.

buffer

Returns a Uint8Array backed by the shared memory mapping. Uses Deno.UnsafePointerView.getArrayBuffer for zero-copy access.

notify

wait

Returns true on notification, false on timeout.

close

Supports Symbol.dispose for using declarations:

Complete example

Permissions

The adapter requires these Deno permissions:
  • --allow-ffi to call Deno.dlopen
  • --allow-read to locate the shared library
Without these, the import will fail with a permission error.

FFI details

The loader resolves target/release/libzinc_core.{so,dylib} relative to the source checkout. Handles use Deno’s opaque PointerValue objects. The adapter targets Deno 2 and requires --unstable-ffi --allow-ffi --allow-read. Keep the region open while any returned view 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.