Skip to main content

@docxio/node

Native Node.js bindings for docxio, powered by napi-rs. Runs Rust code directly without WASM, offering maximum performance for server-side document generation.

Installation​

npm install @docxio/node

This installs a platform-specific native binary (no WASM overhead).

Usage​

The API mirrors the main docxio package:

import { generate } from "@docxio/node";

const documentTree = {
type: "document",
props: { title: "Report" },
children: [
{
type: "section",
props: {},
children: [
{
type: "paragraph",
props: {},
children: [
{ type: "run", props: { bold: true }, children: ["Hello from napi-rs!"] },
],
},
],
},
],
};

const bytes = generate(documentTree);

When to use @docxio/node​

Use @docxio/node instead of the main docxio package when:

  • You are building a Node.js server and want maximum throughput
  • You do not need browser compatibility
  • You want to avoid WASM initialization latency

For most projects, the main docxio package (WASM-based) is sufficient and works across all runtimes.

Supported platforms​

napi-rs provides pre-built binaries for:

  • macOS (x64, arm64)
  • Linux (x64, arm64)
  • Windows (x64)

If a pre-built binary is not available for your platform, installation falls back to compiling from source (requires a Rust toolchain).