Skip to content

Conversation

@financialvice
Copy link
Contributor

Summary

  • Default DocxZipper.updateZip to use DEFLATE compression instead of JSZip's default of STORE (no compression), reducing exported .docx file sizes by ~10x
  • Make the compression method configurable via the compression option on exportDocument() / save() / saveTo(), so callers can opt into STORE for faster exports if needed
  • Add tests verifying DEFLATE produces smaller output than STORE and that the option is respected

Context

JSZip defaults to STORE (no compression) when compression isn't specified in generateAsync(). Since Word and other editors use DEFLATE, a round-trip through SuperDoc was inflating file sizes significantly (e.g., a 27KB input becoming 260KB after export).

Test plan

  • Existing DocxZipper tests pass
  • New test: DEFLATE (default) produces smaller output than STORE
  • New test: explicit compression: 'STORE' is respected
  • Pre-commit hooks pass (format, lint, typecheck)

🤖 Generated with Claude Code

JSZip defaults to STORE (no compression) when compression isn't
specified, causing exported .docx files to be ~10x larger than the
original. This adds DEFLATE as the default compression method in
DocxZipper.updateZip, matching what Word and other editors produce.

The compression method is configurable via the `compression` option
in exportDocument/save/saveTo, allowing callers to opt into STORE
for faster exports on large documents if needed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant