Show HN: TinyDOCX – 5kb Word/ODT library (20x smaller than docx)
https://github.com/Lulzx/tinydocx
After posting tinypdf here, someone opened an issue asking for Word/OpenOffice support. I understand sometimes you need an editable document, not a PDF.But, I didn't want to extend the library itself. So I built tinydocx: ~680 lines of TypeScript, zero dependencies, 5KB gzipped. The popular docx package is 108KB with 5 dependencies.
What's included: - Text formatting (bold/italic/underline, colors, custom fonts) - Headings (H1-H3) - Tables with borders and column widths - Bullet and numbered lists - Images (PNG, JPEG, GIF, WebP) - Hyperlinks - Headers/footers with page numbers - Markdown → DOCX conversion - ODT (OpenDocument) support –> same API
What's not: - Table of contents, footnotes, bookmarks - Track changes, comments - Multi-column layouts, text wrapping - Reading/modifying existing .docx files - Math equations, drawing shapes
DOCX files are just ZIP archives containing XML. Once you understand the structure, generating simple documents is straightforward. The hard part is knowing which XML elements Word actually requires vs. what's optional cruft.
Works great for invoices, reports, form letters or anything where you want the recipient to edit the document. Pairs nicely with tinypdf when you need both formats.
GitHub: https://github.com/Lulzx/tinydocx npm: npm install tinydocx
There are no comments yet.