High-performance XLSX XML parser using WebAssembly for 10-50x faster file imports.
-
Rust - Install via rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
wasm-pack - Install using cargo:
cargo install wasm-pack
-
WASM target - Add the WebAssembly target:
rustup target add wasm32-unknown-unknown
From the project root:
npm run build:wasmOr manually from the wasm directory:
cd wasm
./build.shThe build will output to src/formats/xlsx/wasm/.
The WASM parser is automatically used when available. Initialize it at application startup for best performance:
import { initXlsxWasm, xlsxToWorkbook } from 'cellify';
// Initialize WASM at startup (optional but recommended)
await initXlsxWasm();
// Import will automatically use WASM if available
const { workbook } = xlsxToWorkbook(xlsxBuffer);import { isXlsxWasmReady } from 'cellify';
if (isXlsxWasmReady()) {
console.log('Using WASM-accelerated parser');
} else {
console.log('Using JavaScript parser (fallback)');
}To force JavaScript parsing:
const { workbook } = xlsxToWorkbook(buffer, { useWasm: false });Expected performance improvements for large files:
| File Size | JS Parser | WASM Parser | Speedup |
|---|---|---|---|
| 10K cells | ~500ms | ~50ms | 10x |
| 100K cells | ~5s | ~200ms | 25x |
| 1M cells | ~50s | ~2s | 25x |
cd wasm
cargo testwasm-pack build --target web --out-dir ../src/formats/xlsx/wasm --devThe WASM module provides parsers for:
- Worksheet XML - Cell data, rows, columns, merges
- Shared Strings - String deduplication table
- Styles - Fonts, fills, borders, number formats
- Workbook - Sheet metadata and relationships
- Relationships - Part linking and hyperlinks
All parsing uses quick-xml, a high-performance Rust XML parser that uses zero-copy parsing and streaming for minimal memory overhead.
If WASM is unavailable (not built, failed to load, or disabled), the library automatically falls back to the JavaScript parser. This ensures:
- No breaking changes for existing users
- Graceful degradation in environments without WASM support
- Optional opt-in for performance benefits