Tools — Build it yourself
Write a Real ZIP in the Browser
A ZIP archive feels like infrastructure — the province of command-line tools and operating systems. In its simplest form it is three kinds of record written back to back, and this page writes all of them in JavaScript. Name a few small text files, type their contents, press the button, and the download is a standard .zip that any unzip tool on any system will open. The file is generated from your own input, on your own device; nothing is uploaded anywhere.
Each file you add gets a local file header: a signature, the format version, a timestamp, the file’s CRC-32 checksum, its size, its name — and then the file’s bytes themselves, stored exactly as typed. This writer uses the store method, compression method zero, which means the data is not compressed at all. That sounds like a missed trick, but it is the honest core of the format: DEFLATE compression is an optional layer on top of this same skeleton, and for short text files the skeleton is most of the bytes anyway.
After the files comes the central directory, one record per file repeating its name, checksum, size, and — the crucial field — the byte offset where its local header sits. Readers trust the directory, not a scan: it turns opening an archive with a thousand files into a table lookup. Last is the end-of-central-directory record, a short sign-off that says how many entries the directory holds and exactly where it begins. An unzip tool reads the file backwards from that record, which is why a ZIP can be identified and opened even when it is appended to other data.
The checksum deserves its sentence. CRC-32 is a polynomial division remainder — here the IEEE polynomial, computed with a 256-entry lookup table the script builds once — and it lets a reader verify that the bytes it extracted are the bytes the writer checksummed. It catches corruption, not tampering; it is an integrity check, not a signature. Try the round trip: build an archive here, open it with your system’s unzip tool, and compare the contents with what you typed.
Loading the writer…