Reading a Word document without a library
The allergen tools compare three sources: a spreadsheet, the website, and a Word document of ingredients. Reading that third one looked like it needed a dependency.
A .docx is a zip holding XML, and the only part worth reading is
word/document.xml. Browsers can inflate a raw deflate stream themselves
now. So the whole job is finding that one entry in the zip and stripping the
tags off it — a couple of hundred lines, against the four hundred kilobytes a
docx library would add to a dashboard bundle that is already too big.
What it keeps is deliberately narrow: paragraphs and table cells, each as its own line, in document order. That is the shape the rest of the feature cares about — a product is a line, its ingredients are the next line or the next cell — and everything else in a Word file is noise. Fonts, spacing, revision marks, who last saved it.
The part worth more than the bundle size, though, is where it runs. The document is read on the shop’s own computer. It is never uploaded.
That started as a consequence and became a feature. An allergen document is about as sensitive as a small food business gets: it is the thing an inspector asks for, and the thing a mistake in can hurt somebody. A file that is never uploaded cannot be left on a server, cannot be in a backup, and cannot appear in a breach.
So the interface says so, in those words: “It is read here on this computer and never uploaded.” It is the rare case where the privacy claim and the engineering shortcut are the same decision.