Expand description
Node.js native addon for the WebUI framework via napi-rs.
Provides high-performance server-side rendering by compiling the Rust
WebUI handler directly into a .node native addon — no C ABI intermediary.
The Protocol class decodes pre-compiled protobuf data from webui build
once and provides buffered and streaming render methods.
§Usage (from Node.js)
import fs from 'node:fs';
// Load the native addon
const mod = { exports: {} };
process.dlopen(mod, './target/release/libwebui_node.dylib');
const { Protocol } = mod.exports;
// Read pre-compiled protocol (from `webui build`)
const protocol = new Protocol(fs.readFileSync('./dist/protocol.bin'), 'webui');
const state = '{"name": "WebUI"}';
// Stream rendered fragments
protocol.renderStream(state, 'index.html', '/', (chunk) => process.stdout.write(chunk));Structs§
- JsBuild
Options - Build options for the webui build API.
- JsBuild
Result - Result of a successful build operation.
- JsBuild
Stats - Build statistics returned from the build function.
- JsProjection
Manifest - Inline projection manifest transported through N-API.
- JsStream
Options - Optional per-response streaming settings.
- Protocol
- A decoded protocol and its reusable deterministic indices.
- Streaming
Session - A progressive HTML response driven one chunk at a time from Node.