Press Download on a folder in Nemi and your browser starts saving a zip right away, whether the folder holds three photos or 200 GB of video. There's no wait while an archive is assembled somewhere first. The zip is built while you download it, one file at a time, and none of it is ever stored.
This post explains how that works: why server memory stays flat no matter how big the folder gets, what happens when storage hiccups halfway through a 10 GB file, and the two honest tradeoffs of building a zip on the fly.
Why not build the zip first and then send it?
Building the archive first is the obvious approach, and it brings three problems that grow with every folder. You wait for the whole zip to finish before the first byte arrives. A server has to hold the finished archive in memory or on disk, matching the folder's size. And that space is spent all over again for every person who downloads it.
A zip file doesn't need to be built that way. Each entry is just a small header followed by its file contents, one after another, with the table of contents written at the very end. That means an archive can be streamed front to back and sent out as it's created. Nemi reads one file from storage, feeds it through the zip writer straight to your browser, and moves on to the next. Only one file is ever open at a time.
Memory used while building a zip
A 256 MiB folder
128 MiB files, incompressible
A 1 GiB folder
128 MiB files, incompressible
A 4 GiB folder
128 MiB files, incompressible
How we measuredHide the method
Apple M2 Mac, 8 GB memory, Bun 1.3.11, 2026-10-03. Synthetic files of 128 MiB generated in memory (incompressible, like photos and video) were fed through archiveToWebStream and appendAndDrain from the production zip code at deflate level 1, and the output was read and discarded the way a download sends it on. Storage and the network were not involved.
Peak resident memory sampled every 20 ms, one measurement per process, 3 runs per size, median shown. The benchmark ran under Bun, while Nemi runs on Node, so the finding is the flat shape across sizes, not the exact number of megabytes. The harness is in scripts/blog-bench/streaming-zip-downloads.
The streamed process used 95 MiB at its peak for a 256 MiB folder and 96 MiB for a 4 GiB one, sixteen times bigger. About 68 MiB of that is the runtime before the first file is read; the zip adds a small, roughly fixed amount on top, whatever the size of the folder.
What keeps the memory flat?
Streaming alone isn't enough. If storage sends data faster than your connection can accept it, the excess has to wait somewhere, and on a slow line that buffer would quietly grow to the size of the whole folder. Instead, the browser's end drives the pace. When the outgoing buffer fills up, the zip writer pauses, which stops reading from the file and from storage. When your browser asks for more, everything resumes, so nothing piles up in between.
The same wiring works in reverse when you cancel. Closing the download aborts the pipeline and stops reading from storage, so a cancelled download doesn't keep a server busy fetching files no one will receive.
One folder download, from press to finish
1/5You press Download
Why the browser's download manager, not the page?
A web page can download a file itself by fetching it in JavaScript and saving the result, but then the tab has to hold what it fetched, and a tab can't hold 200 GB. Your browser's built-in download manager has no such limit: it writes straight to disk as bytes arrive, shows progress where you expect it, and keeps going even if you leave Nemi.
The catch is that a browser download starts from a plain link, and a URL can't carry a list of 300 files. So the page sends your selection first. Nemi checks access, expands every folder into its files, and returns a short ticket. The download link only carries that ticket, so the zip starts streaming the instant the browser asks. Each ticket lasts 15 minutes and works only for the person who requested it.
What happens when storage hiccups halfway through a file?
A folder download can mean hundreds of separate reads from storage in a row, and over enough reads, one will fail. If a single failed read killed the download, big folders would always be a gamble.
Instead, Nemi tracks the exact number of bytes already written into the zip for the current file. When a read breaks, it waits briefly and requests the same file again starting from that byte. The zip never notices: the new bytes continue right where the old ones left off, and your browser sees nothing more than a brief pause.
Make storage misbehave
Arriving in your browser, as one download
0.00 GB
Not started
- Interview A.mov
- Interview B.movwaiting its turn
- Stills/DSC_0412.jpgwaiting its turn
- Stills/DSC_0413.jpgwaiting its turn
- B-roll.mp4waiting its turn
- Notes.pdfwaiting its turn
- Start the download, then make storage misbehave while a file is being read.
The retry counter only gives up when retries stop making progress. Every time a resumed read delivers new bytes, the counter resets, so a huge file on a rough day can survive many hiccups as long as each one moves forward.
Even when a file truly can't be read, the download doesn't fail. If it can't be opened after 3 attempts, it's skipped. If storage drops mid-file, the entry is closed where it stopped so the archive stays valid. Either way, a small text note ending in .[ERROR].txt is added to the zip explaining what happened, and the rest of the folder continues. One bad file never costs you the other two hundred.
Storage is allowed to stumble. Your download should never have to know.
Does the zip make my files smaller?
Usually not by much, and that's by design. Most files people keep in folders, such as photos, video, PDFs, and other archives, are already compressed. Compressing them again burns CPU time to save almost nothing, so Nemi uses the lightest zip setting, deflate level 1. Our converter follows the same logic when it packs photos and videos into an archive. A folder of plain text comes out a bit larger than with heavier compression, but in return the server spends minimal time per byte and keeps big downloads moving at your connection's speed.
What are the costs of streaming a zip?
Your browser can't show a percentage. A zip built on the fly doesn't know its final size when it starts, so your browser counts bytes received instead of drawing a progress bar. Knowing the size up front would require building the whole archive first, which is everything this design avoids.
Your own download can't be resumed. Byte-offset resuming happens between Nemi and storage. Between Nemi and your device there's one continuous stream, so if your connection drops or your laptop sleeps, the download has to start over. For huge folders, keep your machine awake and plugged in, or download the biggest files individually, since single files are served directly from storage. Uploads work the other way round: they go up in parts, so an interrupted upload can carry on where it stopped.
The same streaming powers the Download all button on share links, letting recipients grab a whole folder in one go. See Files for more on sharing, and our guide to sending large files securely for link settings. For the customer walkthrough, see Downloading files and zips in the help centre.
Questions people ask
How do I download a folder as a zip?
In Nemi, select a folder, or several files and folders, and press Download. Your browser starts saving one zip straight away, whatever the size, because Nemi builds it on the fly. On a share link, Download all does the same for your recipient.
Why does my zip download not show a percentage?
A zip built on the fly doesn't know its final size when it starts, so your browser counts the bytes received instead of drawing a progress bar. Knowing the size up front would mean building the entire archive first and making you wait.
Why does my zip download keep failing?
Usually the connection between you and the server dropped, or your computer went to sleep, and a streamed zip has to restart from your side. For huge folders, keep your machine awake and plugged in, or download the biggest files individually. Hiccups between Nemi and storage are retried from the exact byte, so you rarely see them.
What happens if one file in the folder cannot be downloaded?
The rest of the zip still arrives. Nemi tries to open each file three times and resumes a broken read from the byte where it stopped. If a file still can't be read, a small text file ending in .[ERROR].txt goes into the zip explaining why, and the rest of the folder follows.
Does zipping files make them smaller?
Usually not by much. Photos, video, PDFs, and other archives are already compressed, so Nemi uses the lightest zip setting, deflate level 1, to keep large downloads moving at your connection's full speed. A folder of plain text comes out slightly larger than with heavier compression.
Can I download a very large folder in the browser?
Yes, when your browser's own download manager does the work, because it writes directly to disk as bytes arrive. Nemi hands off the download with a short ticket instead of fetching the zip inside the page, which a tab couldn't hold for hundreds of gigabytes.
Where the numbers come from
- The streamed archive, backpressure and the byte offset resume
lib/zip-stream.ts (archiveToWebStream, appendAndDrain, appendS3FileResumable) - Folder walking, duplicate names, deflate level and download tickets
lib/workspace-zip.ts - Handing the download to the browser
components/ActionView.tsx (triggerBrowserDownload) - The memory benchmark and its data
scripts/blog-bench/streaming-zip-downloads, lib/blog/data/streaming-zip-downloads.json