Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

npm / WASM

Install

npm install @rudra/wasm

Quick Start

import init, { WasmEngine } from '@rudra/wasm';

await init();
const engine = new WasmEngine();

// Create a document
const doc = engine.create();
const html = doc.to_html();

// Open a DOCX file
const response = await fetch('/report.docx');
const bytes = new Uint8Array(await response.arrayBuffer());
const doc2 = engine.open(bytes);
console.log(doc2.to_plain_text());

// Export to PDF
const pdfBytes = doc2.to_pdf();

With Vite

import init, { WasmEngine } from '@rudra/wasm';
const engine = await init().then(() => new WasmEngine());

With Webpack 5

// webpack.config.js
module.exports = { experiments: { asyncWebAssembly: true } };

Bundle Size

  • Release: ~4.1 MB raw, ~1.6 MB gzipped
  • Includes: DOCX, ODT, PDF, TXT, MD support + CRDT + layout engine