Skip to content

Muhammara WebAssembly

@muhammara/wasm is the browser, Worker, and Node WebAssembly target for MuhammaraJS. It exposes a browser-safe, byte-first API instead of the native Node package's filesystem and stream API.

Documentation Versions

latest tracks the develop branch and can include unreleased behavior. Each normal release tag has its own documentation version. After a release, its tag is made the default Read the Docs version while latest continues to track development.

Node.js Native Addon

For Node.js applications that need filesystem paths, Node streams, or the full native PDF API, use @muhammara/native. Choose @muhammara/native-with-source when the addon must build locally or be rebuilt for Electron. It can be installed as an npm alias for @muhammara/native when that import name must remain unchanged.

Start with Browser Setup. Use the Recipe topic guides for high-level creation, drawing, composition, modification, metadata, and encryption, or the low-level API for PDF writers, readers, and modifiers. The How-To Guides cover concrete browser tasks such as annotations, links, tables, image transforms, page boxes, preview, and download.

Every completed writer and Recipe operation returns an owned Uint8Array. Use it directly with Blob, uploads, downloads, or browser storage.

import { createMuhammaraWasm } from "@muhammara/wasm";

var muhammara = await createMuhammaraWasm();
var pdfBytes = muhammara.createBlankPdf(595, 842);
var pdf = new Blob([pdfBytes], { type: "application/pdf" });

The native @muhammara/native and @muhammara/wasm APIs are intentionally separate. Do not copy native examples that use paths, Node streams, callbacks, or require() into browser code. Review Differences and Restrictions for password and persistence feature boundaries.