Skip to main content

@docxio/zip

JavaScript-side ZIP assembly used by the "minimal" WASM backend. This package is an internal dependency -- most users do not need to install it directly.

Purpose​

The minimal WASM binary (441 KB) only generates XML parts. It does not include ZIP packaging to keep the binary small. @docxio/zip assembles those XML parts into a valid .docx ZIP archive in JavaScript.

How it works​

WASM (minimal)          @docxio/zip
───────────── ──────────────
generate XML parts → assemble ZIP → Uint8Array (.docx)
- document.xml - [Content_Types].xml
- styles.xml - _rels/.rels
- numbering.xml - word/document.xml
- settings.xml - word/styles.xml
- header/footer XML - word/media/*
- .rels files - docProps/core.xml

Installation​

This package is automatically installed as a dependency of docxio when using the "minimal" backend. You do not need to install it separately.

# Only if you need it directly
npm install @docxio/zip

Size: ~8 KB

API​

import { assembleDocx } from "@docxio/zip";

const parts: Record<string, Uint8Array> = {
"word/document.xml": documentXmlBytes,
"word/styles.xml": stylesXmlBytes,
// ...
};

const docxBytes: Uint8Array = assembleDocx(parts);

When is this used?​

  • Minimal backend (backend: "minimal"): Used automatically
  • Full backend (backend: "full"): Not used -- ZIP is assembled in Rust
  • Auto backend (default): Used when the minimal backend is selected