How to batch-decompress woff2 to ttf in ci
- Step 1Install wawoff2 — npm install wawoff2. Same WASM module the browser tool uses; works identically in Node 18+.
- Step 2Walk the WOFF2 directory — fs.readdir(input). For each .woff2 file, call wawoff2.decompress on the bytes. Detect the output flavour from bytes 0–3 of the result and write to .ttf or .otf accordingly.
- Step 3Hook into your build — Add as a one-off migration script (npm run extract-fonts) or as a recurring CI step that compares production WOFF2 hashes against TTF copies in source control.
Frequently asked questions
Is the Node decompression the same as the browser tool?+
Yes — wawoff2 ships the same WASM module to both runtimes. Output bytes are identical. The browser tool exists primarily for security-conscious users who don't want fonts touching a server (even their own).
Can I parallelise?+
Yes. Use Promise.all with a concurrency limit of 4–8. Each WOFF2 decompression takes 100–400 ms; concurrent processing scales linearly with CPU cores.
What about output naming?+
Match the input filename, swap the extension. If the wrapped flavour is OTTO, write .otf. Otherwise .ttf. The JAD tool's auto-naming handles both correctly.
Memory footprint?+
WASM peak memory is ~64 MB regardless of font size. Practical limit per invocation is around 100 MB WOFF2 input — beyond that, split into multiple processes.
Privacy first
Every JAD Font tool runs entirely in your browser using opentype.js and the wawoff2 WASM Brotli encoder. Your fonts never leave your device — verified by zero outbound network requests during processing.