Stop Uploading User Data to Servers, The Browser Already Has Everything You Need

A

Adil Sher

Author

Dec 2, 2026
4 min read
2 views
Stop Uploading User Data to Servers, The Browser Already Has Everything You Need

I'll be honest: when I first read about processing 2GB ZIP files client-side without crashing, my gut reaction was skepticism. I've spent enough time debugging memory leaks and OOM crashes in production to know that "just load it all into RAM" is a classic footgun. But the technique here isn't about loading it all, it's about not loading it at all. And that fundamentally changed how I think about privacy-first features.

A few months back, I was building a tool that needed to parse exported chat histories. The obvious path was the backend: users upload the file, my server processes it, returns the results. Standard, boring, and I'd sleep fine knowing I never touched their data. But I kept thinking: why should they trust me with their personal conversations? Even if I'm ethical and delete everything immediately, that's still a moment where their most private thoughts lived in my database. The technique in the original article solved a problem I didn't even know I could solve.

The Real Problem: Archive Blindness

Here's the thing most developers don't realize about ZIP files: they're indexed backwards. The directory table sits at the end of the file, not the beginning. So if you do what every library teaches you-await file.arrayBuffer()-you're committing to loading every single megabyte, even though you probably only need one tiny JSON file buried inside.

A typical Google Takeout export is 1–2 GB. Maybe 95% of that is photos, videos, and attachments. The actual chat transcript? Often just 10–20 MB. But the moment you call arrayBuffer() on a 1.5 GB file on mobile, the browser tab dies. You never get to your code.

The genius move here is treating the ZIP like a database you can query randomly, rather than a monolithic blob you have to swallow whole.

The Three-Slice Approach That Actually Works

The ZIP spec defines a 22-byte footer called the End of Central Directory record. It points to the actual file directory. This means you can:

  1. Read only the last ~65KB to find this footer (signature: 0x06054b50)
  2. Read just the central directory to see what files exist and where they are
  3. Slice only the specific file you need and decompress it

No npm packages needed. The browser gives you Blob.slice() and DecompressionStream() natively.

function createSliceSource(file) {
 return {
 size: file.size,
 async readRange(start, length) {
 const s = Math.max(0, start);
 const e = Math.min(file.size, s + Math.max(0, length));
 const ab = await file.slice(s, e).arrayBuffer();
 return new Uint8Array(ab);
 },
 };
}

This wrapper treats the file as a seekable stream. You're only hydrating the exact byte ranges you need. For a 2GB file, you might make 4-5 slice calls total. That's it.

My Take: The Edge Cases Are Where Reality Lives

The original article mentions ZIP64, sharded exports, and localized filenames as afterthoughts. These aren't edge cases, they're actual reality for anyone processing real user data.

I've seen ChatGPT exports split across multiple JSON files. I've seen Google Takeout translate folder names into the user's language. I've seen timestamps in three different formats depending on the OS. The core technique is elegant, but shipping this requires obsessive attention to format details. That's not criticism, that's respect. It means the original author actually used this, didn't just theorize about it.

What I'd add: versioning and progressive enhancement matter. Older Safari versions had quirky DecompressionStream behavior. You need fallbacks. You also need to validate the ZIP signature and Central Directory checksum, corrupted exports happen.

The bigger question for me is: how many other privacy-critical features are we pushing to servers because we didn't know the browser had the APIs? This technique works for ZIP parsing. What about PDF extraction? Video frame grabbing? Encrypted file handling?

The Permission Model Shift

There's something philosophically important happening here. By processing everything locally, you're not asking for permission, you're eliminating the need for trust. The user doesn't have to trust your backend, your storage retention policy, or your compliance department. They verify it works offline and they're done.

This is the direction I want to push all my future projects. Not because I'm paranoid, but because it's simpler, faster, and respects the user's autonomy.

What Would You Do Differently?

I'm curious whether anyone reading this has hit the edge cases mentioned, especially with multi-part exports or unusual charsets. Have you shipped something similar? What broke in production that wasn't obvious from the spec?

Source: This post was inspired by "How to Read a 2GB ZIP File in the Browser Without Crashing Mobile RAM (Zero Dependencies)" by Dev.to. Read the original article

Written by Adil Sher

Full stack developer building high-traffic platforms, AI services, and custom web applications. Explore my portfolio, learn about my background, or get in touch.

Related Articles

Stop Pretending Email Verification Is Simpler Than It Actually Is
Web Development Dec 1

Stop Pretending Email Verification Is Simpler Than It Actually Is

Last year, I shipped a tenant signup flow for a property management platform in Islamabad. The product team wanted a "simple fallback" when SMS wasn't available, just send an email verification link, right? Six weeks later, we were debugging a production incident where users had s...

The Career Pivot Myth: Why Recency Beats Potential in 2026 Tech
Web Development Nov 29

The Career Pivot Myth: Why Recency Beats Potential in 2026 Tech

I had a conversation last month with someone who'd been out of active development for nearly two decades. They'd kept up with fundamentals, some Python here, a SQL refresher there, but the gap between "knowing programming" and "shipping code in production" felt impossible to cross....