Skip to main content

Node Package

primadb-node is the native Node package. It wraps the Rust runtime through a Node addon instead of going through the browser WASM path.

Source:

Full API reference:

Build

cd /home/bitnom/Code/gunport/primadb/packages/primadb-node
pnpm install
pnpm run build

Surface

  • local graph operations
  • durable native storage
  • native blob storage
  • bytes helpers
  • subscriptions
  • relay transport
  • WebRTC mesh transport
  • remote watches
  • network hooks

Example

import { Primadb } from "primadb-node";

const db = new Primadb("node-a");
db.openDurableStorage({
kind: "segment_files",
directory: "/tmp/primadb-node-demo",
});

db.setNetworkHooks({
onPull(context) {
if (context.request.kind === "get" && context.request.path.anchor === "private") {
return "private root denied";
}
},
});

Package Examples