Multi-Tier Mobile Streaming: Eliminating Browser Crashes

How ZevSafe's four-tier storage fallback engine (FSA → OPFS → Service Worker → In-Memory) guarantees reliable 5 GB+ encryption across Android and iOS smartphones.

1. The Mobile Browser Storage Crisis

Desktop browsers provide modern disk writing APIs like window.showSaveFilePicker(), which stream data directly to physical files on the hard drive without consuming RAM.

On mobile operating systems (Android and iOS), browser vendors deliberately restrict or disable showSaveFilePicker(). When an application generates large files, it is traditionally forced to accumulate everything into a single Blob object in memory.

⚠️ Mobile Out-Of-Memory (OOM) Termination

A standard smartphone browser tab terminates with an "Aw, Snap!" error when heap allocations exceed 350 MB. Creating a 1 GB encrypted backup in an ordinary web app is impossible on mobile devices without crashing.

2. The Four-Tier Storage Fallback Hierarchy

ZevSafe solves this fragmentation through an intelligent capability-sensing pipeline (js/stream-saver.js):

Architecture · Storage Fallback State Machine
[ Device Capability Detection ]
             |
             +--> Has window.showSaveFilePicker?
             |         YES: --> [ TIER 1: File System Access API (Direct Disk) ]
             |
             +--> Is Mobile (Android/iOS) && Has OPFS (navigator.storage)?
             |         YES: --> [ TIER 3: Origin Private File System (OPFS) ]
             |
             +--> Has Service Worker && Non-Mobile (Firefox / Desktop Safari)?
             |         YES: --> [ TIER 2: Service Worker StreamSaver Pipeline ]
             |
             +--> Incognito Mode / Restricted Environment?
                       FALLBACK: --> [ TIER 4: Memory-Bounded Chunk Fallback ]

3. Tier 1: File System Access API (Desktop Chrome / Edge)

On supported desktop platforms, Tier 1 uses window.showSaveFilePicker to obtain a FileSystemWritableFileStream:

4. Tier 3: Origin Private File System (Android Chrome & iOS Safari)

On mobile devices where FSA is unavailable, ZevSafe promotes Tier 3 OPFS (Origin Private File System) to primary priority:

5. Tier 2: Service Worker StreamSaver (Firefox & Desktop Safari)

On browsers lacking both FSA and synchronous OPFS handles (like older desktop Firefox builds), Tier 2 establishes an in-memory streaming bridge with the Service Worker:

6. Tier 4: Memory Bounded Safe Fallback

If a user opens ZevSafe in a private/incognito window where browsers forbid OPFS and Service Workers, Tier 4 activates: