@docxio/wasm-minimal
Minimal WASM binary for docxio. Generates OOXML XML parts without ZIP packaging.
Purpose​
The minimal WASM module is optimized for browser environments where bundle size matters. At 441 KB, it is roughly half the size of the full WASM module (920 KB).
The trade-off: it only generates XML parts. ZIP assembly is handled in JavaScript by @docxio/zip.
What is included​
- Document tree deserialization (serde-wasm-bindgen)
- OOXML XML generation (quick-xml)
- Input validation and sanitization
What is excluded​
- ZIP packaging (done by
@docxio/zipin JS) - Template parsing and patching
- OOXML validation
- Document tree parsing from JSON
Usage​
Most users interact with this indirectly through the main docxio package:
import { render } from "docxio";
const bytes = await render(doc, { backend: "minimal" });
Direct usage​
For advanced use cases, you can import the WASM module directly:
import init, { generate_document_parts } from "@docxio/wasm-minimal";
await init();
const parts = generate_document_parts(documentTree);
// parts is a Map<string, Uint8Array> of XML file paths to content
Size comparison​
| Module | Size | Includes |
|---|---|---|
@docxio/wasm-minimal | 441 KB | XML generation only |
Full WASM (docxio-wasm) | 920 KB | XML + ZIP + template + validator |
Building from source​
wasm-pack build crates/docxio-wasm-minimal --target web --release
The output is placed in crates/docxio-wasm-minimal/pkg/.